Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
extensive slideshow

extensive slideshow

2004-03-17       - By Andreas Weber

 Back
Reply:     1     2     3     4  

Just to get you started:

Below some code how to randomly load some thumbnails and position them in a
image-stripe.
To avoid exessive download times, I suggest you make two folders with
images: one for the thumbnails and one for the big ones.

HTH
-- ---- ------
Andreas Weber
motiondraw.com



this.createEmptyMovieClip('stripe',1);

// **************************
//         SETTINGS
//***************************

// how many jpegs on the stripe?
stripe.numPix = 4;

// the thumbnails are in the subfolder 'sPix'
stripe.pix = ['sPix/A.jpg', 'sPix/mountain.jpg', 'sPix/77.jpg',
'sPix/B.jpg', 'sPix/bull.jpg','sPix/table.jpg', 'sPix/3whatever.jpg'];


// position the stripe
stripe._x = 30;
stripe._y = 100;

// **************************
//       END SETTINGS
//***************************


// helper
this.createEmptyMovieClip('monitor_mc',2);
stripe.loadCount = 0;
stripe.nextX = 0;

// randomize the order
arrayShuffle(stripe.pix);

// get the ball rolling...
loadImage();

function loadImage(){
  var num = stripe.loadCount;
  var curMC = stripe.createEmptyMovieClip('pix'+num, num + 1000);
  curMC.loadMovie(stripe.pix[num]);
  monitor_mc.targetMC = curMC;
  monitorDownload();
}

function monitorDownload(){
  monitor_mc.onEnterFrame = function(){
    var loaded = this.targetMC.getBytesLoaded();
    var total  = this.targetMC.getBytesTotal();
    if(total > 15){
      //trace(Math.round((loaded/total)*100) + '% loaded');
      if(loaded >= total){
        // position the image
        this.targetMC._x = stripe.nextX;
        stripe.nextX += this.targetMC._width;
        // load next...
        stripe.loadCount++;
        if(stripe.loadCount < stripe.numPix){
          loadImage(stripe.loadCount);
        }else{
          // here could be called another function,
          // e.g. to load the big image
          delete this.onEnterFrame;
        }
      }
    }
  }
}

function arrayShuffle(arr){
  var len = arr.length;
  var rand,temp,i;
  for (i = 0; i<len; i++){
     rand = Math.floor(Math.random()*len);
     temp = arr[i];
     arr[i] = arr[rand];
     arr[rand] = temp;
  }
  return arr;
}



-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Supported by Fig Leaf Software
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Lower Prices for Certified Training! Check out new lower prices for
Certified Macromedia Training from Fig Leaf Software. Expand your
skill set with courses in ColdFusion, Flash, Rich Internet
Applications and .NET in the new year.  Fig Leaf Software provides
the highest caliber instruction at our training centers in Washington  
D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at
your location.

Get the details at http://training.figleaf.com/
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected)
For additional commands, e-mail: flashnewbie-help@(protected)