The Image Loader

Wed, Mar 10, 2010

ActionScript



This is part 4 of a Flash picture gallery tutorial

Now that we have our XML loaded, let’s browse the nodes, and place thumbnails on stage using an Image Loader and the AddChild method.

HERE IS THE SOURCE CODE!

//The ActionScript 3.0 Image Loader for Picture Gallery
// Avraham Saltoun
// solutions at say-web dot com
// FREE to USE, COPY and DISTRIBUTE
var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList

var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest (“data/XMLData.xml”));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded (event:Event) {

xml =XML(event.target.data);
xmlList =xml.children();

for (var i:int =0; i < xmlList.length(); i++) {

imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
imageLoader.x =25;
imageLoader.y = i * 150 +25;
addChild(imageLoader);

}}

Related Articles:

, , , , , , , , ,

Leave a Reply

You must be logged in to post a comment.

My name is Avraham Saltoun, and I live in Jerusalem, Middle East. I am currently on my mid  40's and I am a computer programming technician. Here you will find over one hundred quality video tutorials on Actionscript, and yes, I give online support for aspiring programmers, and pros as well, sharing screen on skype and delivering source code by email, click the button for live flash actionscript support now!

 
oDesk Certified Action Script Programmer
oDesk Certified Adobe Flash CS3 Designer
oDesk Certified Adobe Photoshop 6.0 Designer
Skype Me™!

$7.49 .Com! Score Savings Cartoon Smart Tutorials


1,260
Unique Visitors
Previous 30 Days
Powered By Google Analytics