Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2009, 10:14 AM
Junior Member
 
Join Date: Jun 2009
Posts: 4
Default SetVariable - cannot get script1 to run and trace does not show up

Hi,
I am not sure how to use setVariable in the script. I want some variables from the script to be placed on the first page of my exe. I tried writing it in a script and called the script from flash. But my program does not go into the script file. I have a trace and it doesnt do the trace.

In my flash I have the command like

fscommand("FFish_Run", "script1")
_root.textVariable = textVariable;

In my script1 I have

textVar = new String("hello");
trace(textVar );
FlashPlayer.getVariable("_root.textVariable", textVar )

However, when I preview my application I do not get the trace and instead it says script1 not found. Then I replaced the call as

Ffishcommand.fscommand("FFish_Run", "script1");

Now it does not complain that the script does not exist, but still I do not get the trace.

I want my variables to be loaded when the flash movie opens. I am not sure how to do this. Any help is appreciated.

Thanks
Bharathy
Reply With Quote
  #2 (permalink)  
Old 06-24-2009, 07:34 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default

If you're using as2 or as3, and swfkit 3, it's highly recommended that you use the external interface instead of the fscommands.

Say you've a function in ffish script, returning a string:
Code:
function myFSFunc(param1)
{
    var str;
    ...
    return str;
}
Then you can call it in your as code directly
Code:
textField1.value = ExternalInterface.call("myFSFunc", param1);
Reply With Quote
  #3 (permalink)  
Old 06-25-2009, 06:44 AM
Junior Member
 
Join Date: Jun 2009
Posts: 4
Default

Thank you for the response. I placed my code inside script1. My flash did not seem to call script1. Therefore, I moved my function from script 1 to Initialize and even then it does not seem to call the script from my action script. What do I need to do for my as2 code to call the script? I exactly copied and pasted the above code to see if it printed something, but with no luck. I use swf 3.2. My problems seems to be in action script code not calling the script. Am I missing some steps?

Thank you
Bharathy

Last edited by bharkan; 06-25-2009 at 08:38 AM.
Reply With Quote
  #4 (permalink)  
Old 06-25-2009, 09:29 AM
Senior Member
 
Join Date: Feb 2003
Posts: 212
Default

Did you import the external class?
if ot you may have to use in flash


Code:
textField1.value = flash.external.ExternalInterface.call("myFSFunc", param1);
Reply With Quote
  #5 (permalink)  
Old 06-25-2009, 10:49 AM
Junior Member
 
Join Date: Jun 2009
Posts: 4
Default

Thank you I got it working. I imported the class. I also found another problem. I had set the preference and classPath but for some reason when I logged in as another user, the settings were gone and hence I couldnt get it to do anything. When I checked with the previous user's id it works fine.

Thanks for the help.
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 02:55 PM.


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.