580 posts It's just life. Just live it.
  • Author had a Free File of the Month
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 50 and 99 items
  • Has been a member for 6-7 years
+2 more
agurghis says

Hi. I’m working on a slideshow and i want to load all the images at once like in this gallery but I don’t know how to do it. Can you help me? Please!

3058 posts
  • Community Superstar
  • Has been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
+1 more
wickedpixel says

it’s not a good idea to load all the files at the beginning… makes the user to get bored

580 posts It's just life. Just live it.
  • Author had a Free File of the Month
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 50 and 99 items
  • Has been a member for 6-7 years
+2 more
agurghis says

this is the request so i have to do it :)

723 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
BigZ says
counter = 0
my_mc = new MovieClipLoader();
listener = new Object
my_mc.addListener(listener)

listener.onLoadInit = function(){
    counter+=1
    my_mc.loadClip(image[counter], bigImage[counter]);
}
my_mc.loadClip(image[counter], bigImage[counter]);

in this example “image” is an array with the paths to the images. “bigImage” is an array containing the target movieclip.

You could make put an if statement somewhere, like:

if(counter >= total){
       //start gallery
}
580 posts It's just life. Just live it.
  • Author had a Free File of the Month
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 50 and 99 items
  • Has been a member for 6-7 years
+2 more
agurghis says

Thank you BigZ ;)

2479 posts Premium Scripts, Plugins and Themes
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 7-8 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 200 and 499 users
+1 more
LucidStudios says

Here is furnished version of BigZ’s code:


var counter:Number = 0;
var my_mc:MovieClipLoader = new MovieClipLoader();
var listener : Object = new Object();
my_mc.addListener(listener)

function startLoadingImages():Void{
   loadNextImage();
}

function loadNextImage():Void{
   my_mc.loadClip(images[counter], bigImage[counter]);
}
listener.onLoadInit = function(){
    if( ++counter < images.length ){
      loadNextImage();
    }
    else{
      initGallery();
    }

}
startLoadingImages();
723 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
BigZ says

yeah saafi, I thought he could think of that himself ;) anyways nice refined code :)

glad to be able to help.

580 posts It's just life. Just live it.
  • Author had a Free File of the Month
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 50 and 99 items
  • Has been a member for 6-7 years
+2 more
agurghis says

Thank you both of you ;)

3058 posts
  • Community Superstar
  • Has been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
+1 more
wickedpixel says
var my_mc:MovieClipLoader = new MovieClipLoader();
var listener : Object = new Object();
my_mc.addListener(listener)

function loadNextImage():Void{
   my_mc.loadClip(images[images.length], bigImage[images.length]);
}

listener.onLoadInit = function(){
    images.pop()
    if(images.length > 0) {
        loadNextImage();
        } else {
            initGallery();
        }
}
loadNextImage();

:D

580 posts It's just life. Just live it.
  • Author had a Free File of the Month
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 50 and 99 items
  • Has been a member for 6-7 years
+2 more
agurghis says

I will try it tomorrow, it’s too late now :P

by
by
by
by
by
by