How do you access Library items from classes other than the document class?
For example, if I create a movie clip in Flash and Export it for Actionscript with the name Foo, I can do this in the document class:
var f = new Foo();
this.addChild(f);
And it appears on the stage, as it should. But I need to be able to create other instances of this object from other classes. If I use the same code above in SomeOtherClass.as, I get nothing on the stage, obviously because this class doesn't know about the Foo object in the library.
I know I probably need to use appplicationDomain.getDefinition somehow. This doesn't work:
var a = new ApplicationDomain(ApplicationDomain.currentDomain);
var foo: Class = a.getDefinition ( "com.me.CustomClass" ) ;
var f = new foo( ) ;
addChild ( f ) ;
TypeError: Error #1007: Instantiation attempted on a non-constructor.