flash on 2010-8-1
/**
* Copyright Tamanegi_kenshi ( http://wonderfl.net/user/Tamanegi_kenshi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aV3d
*/
package{
import flash.display.Sprite;
import flash.events.Event;
import flash.ui.Mouse;
public class test extends Sprite{
private var ball:Sprite;
private var ballArr:Array=new Array();
private var ballNum:int=100;
private var angle:int=0;
private var haba:Number=0;
public function test(){
init();
Mouse.hide();
}
private function init():void{
for(var i:int=0;i<ballNum;i++){
ball=new Sprite();
ball.graphics.beginFill(Math.random()*0xffff00);
ball.graphics.drawCircle(0,0,20);
ball.graphics.endFill();
addChild(ball);00
ballArr.push(ball);
ball.y=-15;
ball.scaleX+=i*2;
ball.scaleY+=i*2;
addEventListener(Event.ENTER_FRAME,onEnter);
}
}
private function onEnter(event:Event):void{
for(var j:int=0;j<ballNum;j++){
if(j==0){
var vxM:Number=(mouseX-ballArr[j].x)*0.1;
var vyM:Number=(mouseY-ballArr[j].y)*0.1;
var vsXm:Number=(0-ballArr[j].scaleX)*0.3;
var vsYm:Number=(0-ballArr[j].scaleY)*0.3;
ballArr[j].scaleX+=vsXm;
ballArr[j].scaleY+=vsYm;
ballArr[j].x+=vxM
ballArr[j].y+=vyM;
if(ballArr[j].y>500){
ballArr[j].y=-20;
haba=0;
ballArr[j].scaleX=ballArr[j].scaleY=1;
}
haba+=0.5;
}else{
var vx:Number=(ballArr[j-1].x-ballArr[j].x)*0.7;
var vy:Number=(ballArr[j-1].y-ballArr[j].y)*0.7;
ballArr[j].x+=vx;
ballArr[j].y+=vy;
var vsX:Number=(ballArr[j-1].scaleX-ballArr[j].scaleX)*0.1;
var vsY:Number=(ballArr[j-1].scaleY-ballArr[j].scaleY)*0.1;
ballArr[j].scaleX+=vsX;
ballArr[j].scaleY+=vsY;
}
setChildIndex(ballArr[j],0);
}
}
}
}