James Gain
James Gain

Reputation: 5

Access external SWF classes other than document class AS3?

I'm loading an external SWF as you normally would and I am handling the COMPLETE listener with:

var documentClass:Object;
function onComplete(loadEvent:Event)
{
    documentClass = Object(loadEvent.currentTarget.content);
}

This works perfectly and I can access variables and functions from the document class of the external SWF. However not all the other classes in the SWF's library aren't instantiated in the document class. I would also like to access variables and functions in these other classes, and I am currently using, for example:

var documentClass:Object;
var classOne:Class;
function onComplete(loadEvent:Event)
{
    documentClass = Object(loadEvent.currentTarget.content);
    classOne = loadEvent.target.applicationDomain.getDefinition("ClassName") as Class;
}

This also works. However, there are multiple other classes in the library which I want to access and it is extremely tedious to go through each of them using this method. I was hoping I could use getQualifiedDefinitionNames() (I'm using Flash CC and player 11.3 so it is available) but when I trace it, it doesn't seem to be working.

There has to be an easier way to access the other classes which I don't know of. Can anyone help?

Thank you, James

Upvotes: 0

Views: 144

Answers (0)

Related Questions