0

I have the following callback:

ExternalInterface.addCallback("wasCalledFromJS", callFromJavaScript);

which is implemented like this:

    public function callFromJavaScript(dir:String):void {
    try {
        scriptName = dir.toString();
    } catch (e:*) {
        Alert.show(e.toString());
    }
}

However, when I try to call it from the JS console, in the following way ( with the method defined in How to call flash actionscript callback method from javascript? ):

>>> thisMovie("Flex4TextArea1").wasCalledFromJS("1")

"Error in Actionscript. Use a try/catch block to find error."

It appears as if the code if not even reaching my try/catch block. Can you spot what I'm doing wrong?

EDIT: After adding Security.allowDomain("*"); it works. Why am I required to do this, even when testing on localhost? It is the same domain, is it not?

2
  • Are you viewing through localhost and not some path like C:/my_hosting_area/htdocs Commented Aug 22, 2012 at 15:47
  • It might be that I opened a local file, such as c:/.... Isn't c:/something considered local domain as well? Commented Aug 22, 2012 at 16:11

1 Answer 1

0

Error was caused because domain priviledges were not set.

Sign up to request clarification or add additional context in comments.

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.