Alex.A Posted June 16, 2014 Posted June 16, 2014 for(var i:uint = 0; i < 10; i++){ var temp_item:ITEM = new ITEM(); addChild(temp_item); dQueue.append(new SWFLoader("test_clip" + i + ".swf", {name:"file_name" + i, estimatedBytes:30000, container:temp_item.container_mc, autoPlay:true})); } Guys, how can I get movieclips on upper level of "container_mc" using onChildComplete event listener?
Carl Posted June 16, 2014 Posted June 16, 2014 Hi, assuming you are talking about the onChildComplete of a LoaderMax you can use the event that is passed into the callback function to find the content that was loaded and whatever parents you need. For example if dQueue has {onChildComplete:onChildCompleteHandler} assigned then you can do: function onChildCompleteHandler(event:LoaderEvent):void { trace("\n"); trace("event: \t" + event); trace("event.target: \t" + event.target); trace("event.target.content: \t" + event.target.content); trace(event.target.content.parent); trace("\n"); } Using a LoaderMax that loads a series of images, I get the following traces event: [Event type="childComplete" bubbles=false cancelable=false eventPhase=2] event.target: ImageLoader 'loader4' (images/bird.png) event.target.content: [object ContentDisplay] [object MainTimeline] So inside your onChildComplete callback I would start with event.target.content.parent Keep in mind event = the type of event (complete, childComplete, error etc) event.target = is the loader (ImageLoader, SWFLoader etd) event.target.content is the ContentDisplay Sprite that holds the loaded content
Alex.A Posted June 18, 2014 Author Posted June 18, 2014 trace(event.target.content.parent); Oh, yeah! Thanx!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now