hi, I am using flash remoting with java, and using macromedia flash mx 2004. I have noticed that when i test my movie in flash mx 2004 (using Ctrl Enter command) the same instance of the java class i load is used. For example if i run the movie once and it sets a variable which was 2, to 50 in the java class and i then exit and then test movie again using same command, the variable will be 50, eventhough in the constructor for the class it is set to 2. When i publish the movie into HTML, this does not happen and every time you load the movie it uses a new instance. Is there something wrong with my setting in macromedia flash mx or am i missing a line of code, telling it to use a new instance at start up. Please help Thanks
Cheers David for the reply, but no luck. It did not seem to work. The flash preview still uses the same instance of java when it plays using the test movie command. This is a small test program i made to test flash remoting, can anyone tell if I am missing anything at all. Have I missed an obviuos thing here. -------------------------------------------------------------------------------- --------------------------------------------------------------- // Include NetServices library. #include "C:\Program Files\Macromedia\Flash MX 2004\en\First Run\Include\NetServices.as" #include "NetDebug.as" // Create connection if (inited == null) { inited = true; NetServices.setDefaultGatewayUrl("http://localhost:8100/gateway"); gatewayConnection = NetServices.createGatewayConnection(); flashtestService = gatewayConnection.getService("testJava.testingRemoteEight", this); } //Initialize var's and function's var myVar = 0; var resultMessage = "resultMessageInit"; function Run (){ getMessage(); } function getMessage() { flashtestService.getMessage(); } function getMessage_Result( result ) { resultMessage = result; setTxt(); } stop(); txtBox2_txt = resultMessage + " - " + myVar; added_btn.onRelease = function () { myVar ++; Run(); }; function setTxt () { txtBox2_txt = resultMessage + " - " + myVar; } -------------------------------------------------------------------------------- ----------------------------------- and heres to simple Java program i made to test it -------------------------------------------------------------------------------- ----------------------------------- package testJava; import java.io.Serializable; public class testingRemoteEight implements Serializable { private String message; private int ve; private String name; public testingRemoteEight() { message = "run 0"; ve = 1; name = "Bob"; } public String getMessage () { String temp = message; ve++; message = "run " + ve; return temp; } public void setMessage () { message = "I have been set "; } public int getInt () { return 1230321; } public void setName (String newname) { name = newname; } public String getName () { return name; } } If you have any ideas please reply, this is starting to fustrate me :frown; Thanks
Cheers for the explanation. I was starting to go mad. But this is a real pain if you want to keep the same instance of your class. Testing takes twice as long, as if you make any changes to the java, you have to rename your class to get a new copt onto the http server. Is there any quicker way than renaming the java classes. Can i delete the stored instance of the class forcing a new one to be made Thanks
Don't see what you're looking for? Try a search.
|