Reputation: 111
This is my problem:
I have this class in JavaScript:
var c = new MyClass();
c.myFunction();
c.myFunction2();
c.myFunction3();
//and so on...
How can I reference this with ExternalInterface.call
?
I can't do this: ExternalInterface.call("c.myFunction"));
Upvotes: 2
Views: 1407
Reputation: 6403
Publish it to a server and call the html page that way.
ExternalInterface has issues when running in the flex project file system.
Mostlikely its an embed/crossdomain issue.
Upvotes: 0
Reputation: 408
In order for this to work, the object you are trying to call from Flash needs to have global scope. I.e., this will not work:
// closure to keep vars out of global scope - generally a good thing!
(function() {
var c;
function MyClass() {
}
MyClass.prototype.myFunction = function() {
alert('Do something!');
}
c = new MyClass();
})();
... meanwhile, in Flash ...
ExternalInterface.call("c.myFunction");
What you need is a global entry-point for the object. What errors are you getting, though? Are you getting null
back from the call? Is any specific Error being thrown?
Upvotes: 4