flash on 2010-9-2
♥0 |
Line 52 |
Modified 2010-09-02 05:34:28 |
MIT License
archived:2017-03-20 12:09:24
ActionScript3 source code
/**
* 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/8KxT
*/
package {
import flash.display.AVM1Movie;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Sprite;
[SWF(backgroundColor = 0x000000)]
public class FlashTest extends Sprite {
private var ballArr:Array = [];
private var ballYArr:Array = [];
private var ballNum:int = 100;
private var gravity:Number = 0.9;
private var vy:Number = 0;
public function FlashTest() {
init();
}
private function init():void{
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}
private function onEnter(e:Event):void{
var ball:Ball = new Ball();
addChild(ball);
ball.x = mouseX;
ball.y = mouseY;
}
}
}
import flash.filters.GlowFilter;
import flash.events.Event;
import flash.filters.DropShadowFilter;
import flash.filters.BlurFilter;
import flash.display.BlendMode;
import flash.display.Sprite;
class Ball extends Sprite{
public var vx:Number = Math.random() * 10 -5;
public var vy:Number = Math.random() * 10 -5;
public function Ball(){
graphics.beginFill(Math.random() * 0xffffff);
graphics.drawCircle(0, 0, 20);
graphics.endFill();
this.filters = [new BlurFilter(4, 4, 1), new GlowFilter(0xffffff, 1, 5, 5)];
this.blendMode = BlendMode.ADD;
addEventListener(Event.ENTER_FRAME, onEnter);
}
private function onEnter(e:Event):void{
this.x += vx;
this.y += vy;
if(this.x > 465 || this.x < 0 || this.y > 465 || this.y < 0){
removeEventListener(Event.ENTER_FRAME, onEnter);
parent.removeChild(this);
}
}
}