How to add a MovieClip from the library to the stage programmatically?

actionscript-3, flash

Solution

Symbols within Flash may define ActionScript Linkage.

AS Linkage may be set by right-clicking a symbol from the library and selecting Properties...

Check Export for ActionScript and enter a Class name.

If you don't need to explicitly define a base class beyond the symbol type, you can enter AS Linkage directly from the Library:

This creates a class definition no different than if you had written an ActionScript class.

Create instances by instantiating new instances of your AS Linkage type:

var symbolExample:SymbolExample = new SymbolExample();
addChild(symbolExample);

Problem

I am wondering how to add a MovieClip from the library onto the stage programmatically. How would I go about doing this?

Original source