View Single Post
  #8 (permalink)  
Old 06-19-2007, 12:07 PM
SWFKit SWFKit is offline
Senior Member
 
Join Date: Dec 2002
Posts: 2,022
Default Re:Exchanging Data between FFishScript and FLEX..

There are two problems in your code.

First, in the as2 code, the parameters for the "addCallback" method are incorrect. Your code works in as3, but in as2 the method has three parameters. Therefore in as2 your code should be
Code:
function myFunc(x, y) {   return x + y; }
function myMethod(x, y) { return x + y + y; }

ExternalInterface.addCallback("myFunc", null, myFunc);
ExternalInterface.addCallback("myFunc2", null, myMethod);
Second, in the ffish script code, you cannot call the as functions in the "initialize" script, because at that time (when the "intialize" script is running) the main movie has not been loaded yet, and of course the as functions are undefined. Hence, you can only call them after the as functions have been defined. The following code works well

Code:
Application.registerASMethods("myFunc", "myFunc2");

function testResult() {
trace(myFunc("hello ", "world"));
trace(myFunc2("hello ", "world"));
}

Application.onMovieLoaded = function (movie) {
testResult();
}
Reply With Quote