1
votes

I'm trying to load a swf compiled by the Flex SDK into a swf exported by the Flash IDE and instantiate the assets by way of getDefinition(). Normally this works fine with assets exported from the Flash IDE then loaded into another swf also from Flash IDE.

This is how I could normally do this using only the Flash IDE:
Loader - > Using same ApplicationDomain - > getDefinition(class)

Now, using the 'Test.as' compiled from Flex SDK using the [Embed] metadata tag:
Loader - > Using same ApplicationDomain - > getDefinition("Test_" + class)

The problem is I'd rather not have to keep track of the asset libraries loaded to prefix the class name I'd like to get (('Test_" + class) vs (class)). Is there any way of doing this without referencing the library the class is being pulled from or without accessing the original loader? This way I don't need to know which swf the asset is coming from, just the class name that I could instantiate from the current ApplicaitonDomain.

Thanks

1
Thinking more into it, I think it makes sense. The [Embed] tag is embedding the asset into that class rather than the stage of that fla. This would be why using flex you must prefix the definition with the class it was embedded in rather than it being available in the global namespace. I will just have to hard code each library's class name into the factory class for that type of object in order to instantiate it. Sorry to have bothered!user222514

1 Answers

0
votes

Did you try just loading the swf and when it's completely loaded, getDefinition(class)? No Embeds