Jump to content
Search Community

Adding Progress Event Listener to SWFLoader inside a queu

matthewwilliams test
Moderator Tag

Recommended Posts

Hello. I am trying to pull a SWFLoader from an existing queue and add a ProgressEvent Listener to it. The code below:

 

var loader:SWFLoader = _main.queue.getLoader(String("url to SWFLoader path which is included in my xml"));
		loader.addEventListener(LoaderEvent.CHILD_PROGRESS,onLoadProgress);
		loader.addEventListener(LoaderEvent.CHILD_COMPLETE, completeHandler);
		trace(loader + " loader.... type?");
		loader.load();

 

 

The bit in the xml which is the loader I am trying to get with the above code:

 

 

Event Handler Methods:

 

private function onLoadProgress(e:LoaderEvent):void{
		trace("is the loader event firing?");
		trace(e.target + " :target");
	}

	private function completeHandler(e:LoaderEvent):void{
		trace("Complete EVent has been fired...");
	}

 

Basically I set up a queue in my main.as which loads an xml file which has several SWFLoader nodes inside it. I want to load my assets on demand. So each time I am ready to load a swf I want to grab the swf from the queue add an event listener to listen for progress and complete?

 

Can you help me with the proper syntax to achieve this?

 

Thanks.

Link to comment
Share on other sites

The only problem I see is that you're listening for the wrong event types. You were adding CHILD_PROGRESS and CHILD_COMPLETE listeners which means you were listening for children of the SWFLoader - not the SWFLoader itself. So switch to simply PROGRESS and COMPLETE event listeners and you'll be golden.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...