There is no need to cast. The Loader.content property is defined as a DisplayObject - http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content
but I should have been more strictly typed. function onComplete(loadEvent:Event):void { var loadedContent:DisplayObject = loadEvent.target.content; loadedContent.name = "MyName"; addChild(loadedContent); } On Tue, Jun 15, 2010 at 9:47 AM, Glen Pike <g...@engineeredarts.co.uk>wrote: > Cast it to a DisplayObject then give that a name? > > var obj:DisplayObject = loadEvent.currentTarget as DisplayObject; > obj.name = "my instance"; > > ... > > > On 15/06/2010 14:28, Lehr, Theodore wrote: > >> I am loading a swf via something like: >> >> var loader:Loader = new Loader(); >> >> function startLoad(dfile:String) >> { >> var nRequest:URLRequest = new URLRequest(dfile); >> loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete); >> loader.load(nRequest); >> } >> >> function onComplete(loadEvent:Event):void >> { >> addChild(loadEvent.currentTarget.content); >> } >> >> startLoad("some.swf"); >> >> I want to be able to name the swf that gets loaded... right now it is just >> getting a random name like: instance77 >> >> How can I name it? >> >> _______________________________________________ >> Flashcoders mailing list >> Flashcoders@chattyfig.figleaf.com >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> >> >> > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders