0

let suppose i have a object named "data" which has a callBack function named "closeItem" which does something.

So i have flash file which has a close button. on click of that i am calling this function which closes this item.

So issue is ?

If i pass this "closeItemFunction" as global function this works fine.

but if a pass this function as a "data.closeItem" this doesn;t work throwing some falsh error .

so i just wanna ask that


"does flash only call gobal scoped javascript function" ??

2
  • 1
    How about providing us with some code, and what that "some flash error" is? Feb 29, 2012 at 7:30
  • my Question actually is "does flash only call gobal scoped javascript function" ? it didnt call my JavaScript function so "i assuemed may be some flash error :)"
    – Fire-Hox
    Feb 29, 2012 at 8:51

2 Answers 2

2

You can wrap the JavaScript you want to execute in an anonymous function that you declare and call from ActionScript, like this:

ExternalInterface.call("function() { data.closeItem(); }");

It may seem a bit odd that the function gets called, executed, with the above syntax, it does, but if you prefer you could make the declaration and separate call more explicit, like this:

ExternalInterface.call("(function() { data.closeItem(); })()");
0
1

Short answer (iirc); "yes".

It might be possible to get around by calling

ExternalInterface.call("eval", "data.closeItem()")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.