AS3 embed or import all classes in an external swf without referencing each class separately
actionscript-3
Solution
Rather than using a SWF, it's better to use a SWC. To create a SWC just go into the publish settings of Flash Pro and go to the Flash tab and select "Export SWC". The SWC contains both the SWF and a special manifest with all of the information Flash needs to know about the classes in the SWF.
Then, to use the SWC in another project you go to the AS3 settings (also in the Flash tab of publish settings), head to the Library Path tab and add your SWC (both absolute and relative paths work fine).
Note that this will only work in CS4 or Flex (With Flex I'm fairly sure you can just drag the SWC into your project, but I'll check on that).
Now - if you wanted to load the SWF and use it's assets at runtime, that's a whole different ball of wax. For that to work properly you'll need to fiddle around with the Loader class and ApplicationDomain so that the classes get put into the proper domain. Here's some good info on the subject:
http://www.kirupa.com/forum/showpost.php?p=2123134&postcount=366
Problem
I have an ArtLibrary.swf file which has hundreds of MovieClips exported with class names. I want to be able to use these movies in multiple different flash files i'm working on but I don't know how to properly reference them after using and embed command. The following works: ``` [Embed(source="ArtLibrary.swf", symbol="BirdBodyColor_mc")] var BirdBodyColor_mc:Class; myMC:MovieClip = new BirdBodyColor_mc(); addChild(myMC); ``` In this example, I'm not sure how to reference the individual classes inside the "master class". ``` [Embed(source="ArtLibrary.swf")] var MasterClass:Class; myMC:MovieClip = new BirdBodyColor_mc(); addChild(myMC.BirdBodyColor_mc); ```