vrijdag 7 januari 2011

Another Container Issue Loaders refer to Timeline placed objects!

Simplified the code looks like this:
private var pageContent:MovieClip;
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, pageLoaded);
loader.load(new URLRequest(url), new LoaderContext(true));
private function pageLoaded(loadEvent:Event):void
  {
   pageContent=MovieClip(loadEvent.currentTarget.content);
   pageContent.name=pageLayer.currentPageName;
}
Now I get an error:
Error: Error #2078: The name property of a Timeline-placed object cannot be modified.
 at flash.display::DisplayObject/set name()

At first this didn't make sense to me, but... A loader loads an SWF, everything in this SWF is a Timeline-placed object, so the statement is true..
But I want to change it's name, and it seems I can't..
I'll have to program around it, keeping an array of Loaders, in stead of an array of MovieClips.

Geen opmerkingen:

Een reactie posten