When Swfloader loads the SWF externally, everything is simple, and you can get the loaded SWF-related main class Sprite/movieclip instance directly from the content property of the Swfloader instance.
<s:swfloader id= "SWFLoader" source= "@Embed (source= ' assets/xxx.swf ')"/>
But when Swfloader is embedded in the SWF with the @embed tag as shown above, the content of the Swfloader is no longer the sprite or MovieClip represented by the SWF itself, Instead of a subclass instance of the Moviecliploaderasset class, the source code is as follows
Package Xxx.xxx{import Mx.core.moviecliploaderasset;import Flash.utils.bytearray;public class Main__embed_mxml_ assets_xxx_swf_666811031 extends Moviecliploaderasset{public function main__embed_mxml_assets_xxx_swf_666811031 () { Super (); initialwidth=11000/20;initialheight=8000/20;} private static var Bytes:bytearray = null;override Public function Get Movieclipdata (): bytearray{if (bytes = = null) {bytes = ByteArray (New DataClass ());} return bytes;} [Embed (_resolvedsource= ' x:/xxx/xxx.swf (absolute path to SWF on hard disk) ', mimetype= ' Application/octet-stream ')]public var dataclass: Class;}}
As seen above, the Moviecliploaderasset subclass instance has a public variable of class type named DataClass, and the SWF is embedded with the embed tag (as binary data ByteArray)
[Embed (_resolvedsource= ' x:/xxx/xxx.swf (absolute path to SWF on hard disk) ', mimetype= ' Application/octet-stream ')]public var dataclass: Class;
The SWF's ByteArray can be obtained through a getter named Movieclipdata.
Another Moviecliploaderasset class instance has a private loader:loader variable
private Var Loader:loader
The loader loads the embedded SWF and adds it to its display list as a unique child of the Moviecliploaderasset child class instance
That is to say SwfLoader.content.getChildAt (0) as Loader, you can get the private variable Loader,
This loader.content is the main class that embeds SWF-related Sprite/movieclip
Flex 4 Gets the Swfloader embedded SWF instance