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?

Community
  • 1
  • 1
Geo
  • 93,257
  • 117
  • 344
  • 520
  • Are you viewing through http://localhost and not some path like C:/my_hosting_area/htdocs – Neil Aug 22 '12 at 15:47
  • It might be that I opened a local file, such as `c:/...`. Isn't c:/something considered local domain as well? – Geo Aug 22 '12 at 16:11

1 Answers1

0

Error was caused because domain priviledges were not set.

Geo
  • 93,257
  • 117
  • 344
  • 520