Is there a way to directly call a function of an object?

97 Views Asked by At

As you know, Swiffy convert everything to javascript. Therefore if my AS2 script create an object, it should be stored inside this swiffy object somewhere. And if I create a function for this object in AS2, this function should also exist as javascript thing somewhere. But the question is, where is it? I would be much more convenient if i can direct control things inside the swf converted object

1

There are 1 best solutions below

1
Rick Earnshaw On

Have you tried using flash.external.ExternalInterface.addCallback to bind the function onto the Swiffy container element?

If you adds something like this in your SWF:

flash.external.ExternalInterface.addCallback(
    'saySomething', object, object.saySomething);

Then you should be able to call that from the host page like this:

document.getElementById('swiffycontainer').saySomething('hello');