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? Commented 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 :)" Commented 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(); })()");
Sign up to request clarification or add additional context in comments.

Comments

1

Short answer (iirc); "yes".

It might be possible to get around by calling

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.