Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
artlover

Multiple ImageLoader

Recommended Posts

package com

{

...

 

private var queue:LoaderMax = new LoaderMax({onProgress:progressHandler,onComplete:completeHandler});

...

private function createSlide(xml:XML):void

{

var slideXML:XMLList = xml.Slides.children();//SSSData.xml --> Slides Child

var slideLength:int = xml.Slides.children().length();//Slide Items Length

 

for (var i:int=0; i

{

slideMc=new MovieClip();

slideItemType=String(slideXML. @ type)

 

if (slideItemType == "image")

{

trace(i+". Item Type: Image");

queue.append( new ImageLoader(slideXML. @ path, {name:"image",alpha:1}));

addChild(slideMc);

slideMc.addChild(queue.content);

slideArray.push(slideMc);

}

}

queue.load();

}

 

Error :roll:

 

hmm

how can i add to multiple images in the stage???

 

thanks,

best regards,

Link to comment
Share on other sites

option 1:

 

//you want each name to be unique

queue.append( new ImageLoader(slideXML. @ path, {name:"image" + i,alpha:1}));

 

 

addChild(slideMc);

 

//you want the content of the image loader you just created, not the queue's content

//please read the loaderMax docs on getContent();

 

slideMc.addChild(queue.getContent("image" + i);

 

slideArray.push(slideMc);

 

 

----------

 

Option 2

 

read about the container property in the ImageLoader docs. container allows you specify where the contentDisplay object of the ImageLoader will be placed on the display list.

 

 

 

queue.append( new ImageLoader(slideXML[i]. @ path, {name:"image" + i,alpha:1, container:slideMc}));
addChild(slideMc);

slideArray.push(slideMc);

 

ImageLoader docs:

http://www.greensock.com/as/docs/tween/ ... oader.html

 

and these tutorials cover the concepts of container and content display:

 

http://www.snorkl.tv/2011/08/loading-im ... le-images/

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