Sometimes you just want to embed a symbol from an SWF file what you made with the Flash IDE, but you can have problems. The symbol will not have information about the linked class. You will lose all the functionality that was there, the symbols child objects lose everything too. So how to embed the symbol and maintain the connection with the linked classes?
Lets see the original swf what we will use for embedding. There is a Ball symbol with a SimpleRectangle child. The Ball resizes on mouse over/out events. The rectangle rotates and changes color on mouse over/out events.
This is the original swf (which has the ball on the stage) file symbolSource.swf:
All the actions are done in the classes.
If you try to embed the symbol (Ball) you will lost all the functionality:
<!--[CDATA[ [Embed(source="assets/symbolSource.swf", symbol='Ball')]-->
And the result functionality, nothing:
And now try the other way, embed the whole SWF file:
<!--[CDATA[ [Embed(source="assets/symbolSource.swf")]-->
And everything works:
The trick is that even if you embed the whole SWF, when you make new instance you have to wait while it is loaded, and after you can get the classes from the SWF file.
The whole source:EmbeddingSymbol.rar

Tuesday, 29. December 2009
Very nice blog, your article is interesting, i have bookmarked it for future referrence