Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>heres what you can use... this loads all images in the background and will give you notification when the first one is loaded so you can display it immediately and when all are loaded... if there are a lot of images i suggest loading only the next one... not all of them to not be a memory hog..</p> <pre><code>var loadedImages:Vector.&lt;DisplayObject&gt; = new Vector.&lt;DisplayObject&gt;; var imageUrls:Vector.&lt;String&gt; = new Vector.&lt;String&gt;; // set your image urls, manually, from xml... whatever imageUrls.push("http://www.mySite.com/image0.jpg"); imageUrls.push("http://www.mySite.com/image1.jpg"); imageUrls.push("http://www.mySite.com/image2.jpg"); // load all image sequentially var curImageLoadingIndex:int=0; loadNextImage(); /** loads each image sequentially via recursive calls */ function loadNextImage():void{ if (curImageLoadingIndex&gt;=imageUrls.length){// done loading allImagesLoaded() }else{// load next one var ldr:Loader=new Loader(); ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded); ldr.load(new URLRequest(imageUrls[curImageLoadingIndex])); function loaded(event:Event):void{ ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE,loaded);//remove listener to prevent memory leaks loadedImages.push(ldr);//store loaded image for user whenever needed if (curImageLoadingIndex==0) firstImageReady(); curImageLoadingIndex++;//increment to load the next item loadNextImage(); } } } /** notificaltion when all the images have been loaded */ function allImagesLoaded():void{ // know all images are loaded here... } /** first image ready to use */ function firstImageReady():void{ var fistImage:DisplayObject = loadedImages[0]; // do something with your image here... } </code></pre> <p>and if you want to use UILoader just change 2 lines in the request</p> <pre><code> var ldr:Loader=new UILoader(); ldr.addEventListener(Event.COMPLETE,loaded); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload