點選不同次數而改變排列的AS

//


import mx.transitions.Tween;


//


function setup() {


picTotal = 100;


allLayer = this.createEmptyMovieClip(“allLayer”, 0);


picW = 5;


penTNumber = 5;


penCNumber = 0xFFFFFF;


penANumber = 50;


startX = 0;


startY = 0;


picLocX = 800;


picLocY = 600;


spdNumber = 3;


spdDelay = 30;


drawPic();


mouseClickTime = 0;


}


function drawPic() {


for (i=0; i<picTotal; i++) {


obj = allLayer.createEmptyMovieClip(“mc”+i, i);


//


penT = Math.round(Math.random()penTNumber);


//penC = Math.round(Math.random()penCNumber);


penA = Math.round(Math.random()penANumber+51);


picLocationX = Math.round(Math.random()picLocX);


picLocationY = Math.round(Math.random()picLocX);


obj.Xspd = ((Math.random())+1(Math.round(Math.random()2)2-1))/spdDelay;


obj.Yspd = ((Math.random())+1(Math.round(Math.random()2)2-1))/spdDelay;


//


obj.lineStyle(penT,penCNumber,penA);


obj.moveTo(startX,startY);


obj.lineTo(startX,startY-picW);


obj.lineTo(startX,startY+picW);


obj.moveTo(startX-picW,startY);


obj.lineTo(startX+picW,startY);


//


obj.x = picLocationX;


obj.y = picLocationY;


//


obj.allscale = 100;


}


}


function picMov1Low() {


obj.xscale = obj.yscale = 100;


picSpace = 10;


low = 10;


//pic move’s X Space


picMXSpace = 30;


picMYSpace = 30;


i = -1;


//


this.onEnterFrame = function() {


i++;


obj = allLayer[“mc”+i];


//tmpX = i(obj.width+picSpace);


//obj.xscale = obj.yscale = obj.allscale;


picXScale = new Tween(obj, “xscale”, mx.transitions.easing.Regular.easeOut, obj.xscale, obj.allscale, 1, true);


picYScale = new Tween(obj, “yscale”, mx.transitions.easing.Regular.easeOut, obj.yscale, obj.allscale, 1, true);


ans1 = i%low;


ans2 = (i-ans1)/low;


tmpX = ans1picMXSpace;


tmpY = ans2picMYSpace;


picXTween = new Tween(obj, “x”, mx.transitions.easing.Regular.easeOut, obj.x, tmpX, 1, true);


picYTween = new Tween(obj, “y”, mx.transitions.easing.Regular.easeOut, obj.y, tmpY, 1, true);


if (i>=picTotal) {


delete this.onEnterFrame;


}


};


}


click 1, array


function picMov2Cir() {


fullCircle = 360;


radious = 200;


i = -1;


this.onEnterFrame = function() {


i++;


obj = allLayer[“mc”+i];


person = 360/picTotal;


rad = (iperson)/180Math.PI;


obj.xscale = obj.yscale = 100;


cirX = Math.sin(rad) * radious + 400;


cirY = Math.cos(rad) * radious + 300;


//obj.x = cirXradious+300;


//obj._y = cirYradious+300;


picXTween = new Tween(obj, “x”, mx.transitions.easing.Elastic.easeOut, obj.x, cirX, 1, true);


picYTween = new Tween(obj, “y”, mx.transitions.easing.Elastic.easeOut, obj.y, cirY, 1, true);


if (i>=picTotal) {


delete this.onEnterFrame;


}


};


}


click 2 - circle


function picMov3Cir2 () {


radious2 = 300;


i = -1;


this.onEnterFrame = function() {


i++;


obj = allLayer[“mc”+i];


person = 360/picTotal;


rad = (iperson)/180Math.PI;


cirX = Math.sin(rad) * radious2 + 400;


cirY = Math.cos(rad)/3 * radious2 + 300;


obj.xscale = obj.yscale = Math.cos(rad/2) * 800


//obj.x = cirXradious+300;


//obj.y = cirYradious+300;


picXTween = new Tween(obj, “x”, mx.transitions.easing.Strong.easeOut, obj.x, cirX, 1, true);


picYTween = new Tween(obj, “y”, mx.transitions.easing.Strong.easeOut, obj.y, cirY, 1, true);


//


if (i>=picTotal) {


delete this.onEnterFrame;


}


};


}


click 3 - ellipse & scale


this.onMouseDown = function() {


mouseClickTime++;


if (mouseClickTime%3 == 1) {


picMov1Low();


} else if (mouseClickTime%3 == 2) {


picMov2Cir();


} else if (mouseClickTime%3 == 0){


picMov3Cir2();


}


};


setup();


click 4 - auto array



留言

這個網誌中的熱門文章

html嵌入youtube影片當背景,並靜音

css小發現:隱藏捲軸、強迫物件換行

好用的企畫編輯軟體- Axure