View Single Post
  #2 (permalink)  
Old 02-26-2007, 01:21 PM
SWFKit SWFKit is offline
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Exchanging Data between FFishScript and FLEX..

Although you can use the getVariable method to get properties of the Application object (or any components in the Application container), such as _x, _y, _width, _height, it cannot return the value of a variable defined in the Application container. The name of the Application container is the name of your project plus 0. For example, if your project is "myTest", then the name of the Application container is "myTest0", and you can get its properties in ffish script like
Code:
var x = FlashPlayer.getVariable("_level0.myTest0._x");
To pass data between flex 2 and ffish script, you can use the ExternalInterface object to call as3 functions in ffish script or call ffish script functions in as3, both synchorously:

1. calling as3 function from within ffish script

i) in as 3 define and register a function
Code:
*********function myFunc(x, y)
*********{
************return x + y;
*********}
*********
*********function myMethod(x, y)
*********{
************return x + y + y;
*********}

************ExternalInterface.addCallback("myFunc", myFunc);
************ExternalInterface.addCallback("myFunc2", myMethod);
ii) calling the methods in ffish script
Code:
// The "registerASMethods" method turns any as2 or as3 
// callback functions into ffish script global functions. That is to say,
// you can call the action script functions directly in ffish script 
// after calling this method 
Application.registerASMethods("myFunc", "myFunc2");
trace(myFunc("hello ", "world"));
trace(myFunc2("hello ", "world"));
Reply With Quote