JSwiff
flash movies the java way
JSwiff Forum
  Search   Recent Topics     Member Listing    Back to home page 
Register / 
Login 
DefineFunction question  
Forum Index -> Development
Author Message
Anonymous



when I create a DefineFunction in ActionBlock like this:

private static ActionBlock addFunction(ActionBlock ab,String obj,String method){

ab = addPush(obj,ab);
SetVariable sv = new SetVariable();
ab.addAction(sv);
ab = addPush(method,ab);


DefineFunction df = new DefineFunction("",null);

ab.addAction(df);
SetMember sm = new SetMember();
ab.addAction(sm);

return ab;
}
private static ActionBlock addPush(String obj,ActionBlock ab){
...
}

I just new a defineFunction, but when I run
SWFWriter writer = new SWFWriter(doc, new FileOutputStream("test.swf"));
writer.write();

a exception:
java.lang.NullPointerException
at com.jswiff.swfrecords.actions.DefineFunction.getSize(Unknown Source)
at com.jswiff.swfrecords.actions.ActionBlock.write(Unknown Source)
at com.jswiff.swfrecords.tags.DoAction.writeData(Unknown Source)
at com.jswiff.swfrecords.tags.Tag.initData(Unknown Source)
at com.jswiff.swfrecords.tags.Tag.write(Unknown Source)
at com.jswiff.swfrecords.tags.TagWriter.writeTag(Unknown Source)
at com.jswiff.swfrecords.tags.TagWriter.writeTags(Unknown Source)
at com.jswiff.swfrecords.tags.TagWriter.writeTags(Unknown Source)
at com.jswiff.SWFWriter.write(Unknown Source)
at Testmain.main(Testmain.java:130)
Exception in thread "main"

can anyone help me?
Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

It seems there is sth wrong with "writer.write();"

If delete this, that will be ok.

And I also beg the answer.
Ralf



Joined: Jul 20, 2005
Messages: 127
Location: Germany
Offline

Hi Jim. At first glance, the cause seems to be a missing check for null for the parameters String array in DefineFunction.getSize(). Until this gets fixed, I suggest you instantiate DefineFunction using a zero length array instead of null:
Code:
 DefineFunction df = new DefineFunction("",new String[0]);

Please let me know if this fixes the problem.
Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

Ralf:
Yes, It is right.

Thanks for your help.

Jim
Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

By the way, would you please tell me which day the next release is?

And can I look at the roadmap of jswiff?
Anonymous



Hi Jim,
I fixed the NPE cause in DefineFunction in the repository. I also started the nightly build manually so you can don't have to build it yourself, just download the nightly JAR build.
There will be a few release candidates which will just fix known bugs. There won't be any feature enhancements before v1.0, which will be released by Sept. 15th, if all goes well.
There isn't something like an 'official' JSwiff roadmap yet, as at this time I'm evaluating the priority of features. It would be great if you let me know what feature is most important for you.
Ralf



Joined: Jul 20, 2005
Messages: 127
Location: Germany
Offline

Forgot to log in The post above is mine
Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

ok, Ralf. Thanks for your reply.

I'm at work on analyzing and adding new function for swf now, so whether we can us as file in java directly is my interst.

I want to work somthing for swf2as and as2swf based on jswiff, if jswiff's next few releases don not contain it.
Ralf



Joined: Jul 20, 2005
Messages: 127
Location: Germany
Offline

Hi Jim,
I'm at work on analyzing and adding new function for swf now, so whether we can us as file in java directly is my interst. 

I'm not so sure what you're talking about, give me more details and I'll try to help.
I want to work somthing for swf2as and as2swf based on jswiff, if jswiff's next few releases don not contain it. 

I'll write a compiler for JSwiff, but not for ActionScript. I'll try to define a language which will basically be a subset of Java, so Java programmers can easily use it. This way I will be able to reuse parts of the Eclipse IDE (especially the JDT part). An Eclipse based Flash IDE built on JSwiff is the ultimate goal.. but it won't be available until next year.
Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

Ralf:
sorry, I made a mistake,
I'm at work on analyzing and adding new function for swf now, so whether we can USE 'AS' file in java directly is my interst.
That is after uploading a swf, we will find a component such as a button in it, and add some event function for this button. if we use new defineFunction for this, it will have to use a lot of code. In my opinion if we can use AS FILE directly in java, it is perfect.



You can contact me directly, you know my email
Ralf



Joined: Jul 20, 2005
Messages: 127
Location: Germany
Offline

If I understand correctly, you want to use an ActionScript file (as file = ActionScript file?) in your Java code. That's not possible yet, and writing an ActionScript compiler is pretty low on my priority list. If I write a compiler, I will also define a language with stronger typing than ActionScript - and as I said, a Java subset would be cool - but that is really hard work
PS: I don't have access to your mail address. You can send me a private message if you don't want to make it available.
 
  Forum Index -> Development
Go to:   
Legal notes
Powered by JForum 2.1.4 © 2005 - Rafael Steil