Hey Patrick, this is a snippet from Grant's FlashLib class:
public static function getInstance(className:String):DisplayObject {
var SymbolClass:Class = getDefinition(className);
return (SymbolClass) ? new SymbolClass() : null;
}
public static function getDefinition(className:String):Class {
return (inited) ?
loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class
: null;
}
I think getDefinition is what you're after. Use the loader object of the
swf you loaded obviously
good luck!
On 6/18/07, Patrick Matte|BLITZ <[EMAIL PROTECTED]> wrote:
Using getDefinitionByName, can you find a class that's inside a loaded
swf?
Like in this example, Test is a class inside "test.swf".
public function GetDefinitionByNameExample() {
var request:URLRequest = new URLRequest("test.swf");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE
,completeEvent);
loader.load(request);
}
private function completeEvent(e:Event):void{
var ClassReference:Class = getDefinitionByName("Test") as Class;
var instance:Object = new ClassReference();
}
I get an Error #1065: Variable Test is not defined.
But it works fine if I call getDefinitionByName from within test.swf So is
it something I'm doing wrong or does this method only works within a single
swf?
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
--
[ JPG ]
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com