|
|||
|
I'm having a problem with setVariable modifying the variable in Flash......
============================ In the skp file I have: //Initialize function showDialogBox (vMsg) { Dialogs.msgBox(vMsg,'Value', 16); } function changeValue() { FlashPlayer.setVariable("_root.test","value changed"); } return true; ============================ In the swf file I have: fscommand("ffish_eval", "showDialogBox('"+ _root.test+"')"); _root.test = "orgValue"; fscommand("ffish_eval", "showDialogBox('"+ _root.test+"')"); fscommand("ffish_eval", "changeValue()"); fscommand("ffish_eval", "showDialogBox('"+_root.test+"')"); stop(); ============================ The output from the dialog box is: blank orgValue orgValue ============================ The third value in the popup should be "value changed", right? Please help! Thanks, Steve |
|
|||
|
Hi, Steve
You can treat the fscommands as messages which are sent from within Action script to the FFish script. The Action script engine just sends them without waiting for the return of the fscommands. That is to say, the action script engine doesn't care if the fscommands have been really executed. In fact, the FFish script engine has no chance to execute the fscommands while the Action Script engine is still working. The fscommands Code:
fscommand("ffish_eval", "showDialogBox('"+ _root.test+"')");
fscommand("ffish_eval", "changeValue()");
fscommand("ffish_eval", "showDialogBox('"+_root.test+"')");
Now as you can see, the value of "_root.test" is passed to the last fscommand Code:
fscommand("ffish_eval", "showDialogBox('"+_root.test+"')");
fscommand("ffish_eval", "changeValue()"); isn't executed by the FFish Script engine yet. So you cannot get the result as you want. You can change the third fscommand to Code:
fscommand("ffish_eval", "showDialogBox(FlashPlayer.getVariable('_root.test'))");
E.g. In ffish script Code:
function changeValue() {
FlashPlayer.setVariable("_root.test","value changed");
FlashPlayer.targetCallLabel("_root", "a frame that would be called after the change of the _root.test");
}
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|