blendMode = "add" on 2012-8-26
/**
* Copyright Seiya.Kai ( http://wonderfl.net/user/Seiya.Kai )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ndDK
*/
package
{
import flash.display.Sprite;
[SWF(width="600",height="600",frameRate="60")]
public class Main extends Sprite
{
public function Main()
{
var sr:Sprite = new Circle(0xFF0000,100);
var sg:Sprite = new Circle(0x00FF00,100);
var sb:Sprite = new Circle(0x0000FF,100);
sr.x = 300; sr.y = 250;
sg.x = 250; sg.y = 350;
sb.x = 350; sb.y = 350;
stage.addChild(sr);
stage.addChild(sg);
stage.addChild(sb);
}
}
}
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.ui.Mouse;
class Circle extends Sprite
{
public function Circle(_color:uint,_radius:Number,_blend:String="add")
{
graphics.beginFill(_color,1.0);
graphics.drawCircle(0,0,_radius);
graphics.endFill();
blendMode = _blend;
addEventListener(Event.ENTER_FRAME,Move);
addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
}
private function Move(e:Event):void
{
x += Math.round(Math.random()*2) - 1;
y += Math.round(Math.random()*2) - 1;
}
private function onMouseDown(e:MouseEvent):void
{
startDrag();
}
private function onMouseUp(e:MouseEvent):void
{
stopDrag();
}
}