Jump to content
Search Community

Image Loader with variable as URL

Yes! test
Moderator Tag

Recommended Posts

Using image loader with a dynamic url, how do I use a variable as the url?

 

This is without the var

 

//create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners
var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
 
//append several loaders
queue.append( new ImageLoader("images/1286579991.jpg", {name:"photo1", estimatedBytes:2400, container:LoaderMc, alpha:0, width:520, height:390}) );


 

I tried this, but it did not work yet.

 

var myUrlbase = "/images/";
var myImgLink = "1286579991.jpg";
var myUrl = myUrlbase+myImgLink;
trace(myUrl);

//create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners
var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
 
//append several loaders
queue.append( new ImageLoader(myUrl, {name:"photo1", estimatedBytes:2400, container:LoaderMc, alpha:0, width:520, height:390}) );

 

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