URLRequest (Loading pictures on the fly)

I don’t think I need a demo file for this stuff. The only reason why its here is simply due to the amount of request to do it.

You creating a Gallery or something visually heavy? It best to dynamically load these images into your SWF. Why?

  • Keeps your final file size down so the user sees your interface faster
  • you now have the ability to quickly change a picture when needed without re-editing your FLA

Place this code in your timeline and your done:

//creating the request to collect our image.
var url:URLRequest = new URLRequest("http://a3.twimg.com/profile_images/440789033/jay-jagpal.jpg");
 
//use the class of which does picture loading
var loader:Loader = new Loader();
 
//Tell the flash to load the request...
loader.load( url );
 
//Can manipulate it just like a normal movieclip - as it inherits displayObject class.
loader.x = 60;
loader.y = 60;
loader.rotation = 33;
loader.alpha = .6;
 
//Add it to the screen - just because its made in memory, doesn't mean its on the screen!
addChild( loader );

No Comments

Post a Comment

Your email is never shared. Required fields are marked *