Arrange MCs from Library to Stage


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. private function attachThumbs (anzreihe:Number, anzgesamt:Number, itemwidth:Number, itemheight:Number, margin:Number) :Void {
  2.  
  3. trace("attachThumbs");
  4.  
  5. var anzahl_reihe:Number = anzreihe;
  6. var anzahl_gesamt:Number = anzgesamt;
  7.  
  8. var mc_breite:Number = itemwidth;
  9. var mc_hoehe:Number = itemheight;
  10.  
  11. var abstand:Number = margin*2;
  12.  
  13. var x_wert:Number = 48;
  14. var y_wert:Number = 248;
  15.  
  16. var x_start:Number = x_wert/2;
  17. var y_start:Number = y_wert/2;
  18.  
  19. for (var i:Number=0; i<anzahl_gesamt; i++) {
  20.  
  21. var initObj:Object = new Object();
  22. initObj.targetx = x_start+(i%anzahl_reihe)*(mc_breite+abstand);
  23. initObj.targety = y_start+Math.floor(i/anzahl_reihe)*(mc_hoehe+abstand);
  24.  
  25. initObj._x = initObj.targetx;
  26. initObj._y = initObj.targety;
  27.  
  28. initObj._alpha = 0;
  29. initObj.count = i;
  30.  
  31. var tmpMC:MovieClip = UI.attachMovie("VideoThumb","videothumb"+i,i+3, initObj);
  32. tmpMC.loadThumbPic(imagepath+"thumb.png");
  33.  
  34. tmpMC.alphaTo(100,1,'linear',i*0.1);
  35. //tmpMC.tween(["_alpha","_x","_y"],[100,initObj.targetx,initObj.targety],1,'easeOutQuad',i*0.1);
  36.  
  37. }
  38.  
  39. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.