Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-23-2004, 09:04 PM
Junior Member
 
Join Date: Jun 2003
Posts: 29
Default setVariable not working

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

Reply With Quote
  #2 (permalink)  
Old 11-23-2004, 09:23 PM
Junior Member
 
Join Date: Jun 2003
Posts: 29
Default Re:setVariable not working

BTW - this is running as a stand alone application on the harddrive.
Reply With Quote
  #3 (permalink)  
Old 11-24-2004, 10:41 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:setVariable not working

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+"')");
are queued to be executed later by the FFish script engine.

Now as you can see, the value of "_root.test" is passed to the last fscommand
Code:
fscommand("ffish_eval", "showDialogBox('"+_root.test+"')");
But the second fscommand
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'))");
If you want to wait for the change of the _root.test, a callback function or frame would be helpful.

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");
}
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:34 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.