Jump to content
Search Community

Possible to save data in a Loader/LoaderEvent?

dmb85 test
Moderator Tag

Recommended Posts

So basically I have a SWFLoader loading a swf. When the swf is done, I want to receive a LoaderEvent to my onComplete function that contains a string that I've defined in its data. Is this possible?

 

Or is it possible to store a string somewhere inside the SWFLoader itself? I tried making a custom property in the vars object when instancing the SWFLoader, but it seems that custom properties understandably get ignored and always show as undefined. I could extend the functionality myself, but I was just wondering if im overlooking something that already exists.

 

Thanks!

Link to comment
Share on other sites

good question. the custom data is stored in the vars of the target of the event.

 

consider the following:

 

var swf:SWFLoader = new SWFLoader("someswf.swf", {hasselhoff:"david", onComplete:completeHandler, container:this});
swf.load();

function completeHandler( e:LoaderEvent ):void{
trace("complete ");
trace(e.target.vars.hasselhoff); //output david
}

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...