1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| import mx.transitions.Tween;
import mx.transitions.easing.*;
var totalImage:Number = 37;
function load(aIndex:Number) {
var tmp:MovieClip =this.createEmptyMovieClip("conteneur_"+aIndex, aIndex);
var listener:Object = new Object();
listener.onLoadInit = initialisation;
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(listener);
var fileName:String = "ref/img_"+("00").substr(0, 2-aIndex.toString().length)+aIndex+".jpg";
mcl.loadClip(fileName, tmp);
}
function initialisation(aTarget:MovieClip) {
var currentIndex:Number = Number(aTarget._name.split("_")[1]);
if (currentIndex+1<totalImage) {
load(currentIndex+1)
}
aTarget._width = aTarget._height = 50;
var clip = this["conteneur_"+currentIndex];
var thumbs = this["thumb_"+currentIndex];
clip.indice = currentIndex;
thumbs.indice = currentIndex;
thumbs.onRollOver = function() {
var rotation:Tween = new Tween( this, "_rotation", Elastic.easeOut, 0, 15, 22, false );
}
thumbs.onRollOut = function() {
var rotation:Tween = new Tween( this, "_rotation", Elastic.easeOut, 15, 0, 22, false );
}
thumbs.onRelease = function() {
thumbs._alpha = 0;
clip._alpha = 100;
clip.swapDepths(1000);
X = this["thumb_"+currentIndex]._x;
Y = this["thumb_"+currentIndex]._y;
var zoom:Tween = new Tween( clip, "_width", Elastic.easeOut, 48, 650, 40, false );
var zoom:Tween = new Tween( clip, "_height", Elastic.easeOut, 48, 650, 40, false );
var zoom:Tween = new Tween( clip, "_x", Elastic.easeOut, X+1, 60, 40, false );
var zoom:Tween = new Tween( clip, "_y", Elastic.easeOut, Y+1, 20, 40, false );
}
clip.onRelease = function() {
var dezoom:Tween = new Tween( clip, "_width", Elastic.easeOut, 650, 48, 40, false );
var dezoom:Tween = new Tween( clip, "_height", Elastic.easeOut, 650, 48, 40, false );
var dezoom:Tween = new Tween( clip, "_x", Elastic.easeOut, 60, X+1, 40, false );
var dezoom:Tween = new Tween( clip, "_y", Elastic.easeOut, 20, Y+1, 40, false );
dezoom.onMotionFinished = function() {
clip._alpha = 0;
thumbs._alpha = 100;
}
}
}
load(0); |
Partager