Jump to content



Recommended Posts



i tried to pass custom parameters when an image is loaded with the imageLoader Class. it's possible to do that with onCompleteParams like i do it with TweenMax?



Link to comment
Share on other sites

Hey ya mate,


I don't know if the official docs have been updated but you can add properties to your imageLoader objects by using the prop attribute:


var iLoad:ImageLoader = new ImageLoader("myImage",

new ImageLoaderVars()


.prop("prop1", "Hello")



Then you can access those params on a click or complete event like so:


var vars:Object = ImageLoader(e.currentTarget.loader).vars


Link to comment
Share on other sites

Yep, Zync is exactly correct. And to answer your specific question, no there is no such thing as onCompleteParams in LoaderMax because everything is event-based rather than callback-based. There are some rather compelling reasons why this is a better approach for a loading system like this, but callbacks are better suited for tweening which is why I used them accordingly.


You can store whatever you want in the "vars" object that you pass into the loader. So, for example:


var loader:ImageLoader = new ImageLoader("1.jpg", {myCustomData1:"whatever", myFunkyVariable:"yesThisWorks", onComplete:test});

function test(event:LoaderEvent):void {
   trace(event.target + " completed, myCustomData1 is " + event.target.vars.myCustomData1 + ", and myFunkyVariable is " + event.target.vars.myFunkyVariable);

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.