flash on 2011-5-23
/**
* Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9LRo
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.ColorTransform;
public class FlashTest extends Sprite {
var sw:Number = stage.stageWidth/2;
var sh:Number = stage.stageHeight/2
var myColor:ColorTransform = new ColorTransform();
public function FlashTest() {
// write as3 code here..
stage.addEventListener(MouseEvent.MOUSE_DOWN,xDown);
function xDown(e:Event):void {
var mySp:Sprite = new Sprite();
mySp.x = sw;
mySp.y = sh;
addChild(mySp);
var mySprite:Sprite = new Sprite();
mySprite.graphics.lineStyle(1,0xCCCCCC,1);
mySprite.graphics.moveTo(0,0);
mySprite.graphics.lineTo(mySp.mouseX,mySp.mouseY);
mySprite.addEventListener(Event.ENTER_FRAME,xMove);
mySp.addChild(mySprite);
var mySpriteC:Sprite = new Sprite();
mySpriteC.graphics.beginFill(0xCCCCCC,1);
mySpriteC.graphics.drawCircle(0,0,5);
mySpriteC.graphics.endFill();
mySpriteC.x = mySp.mouseX;
mySpriteC.y = mySp.mouseY;
myColor.color=Math.random()*0xffffff;
mySpriteC.transform.colorTransform=myColor;
mySprite.addChild(mySpriteC);
}
function xMove(e:Event):void {
var mySprite:Sprite = e.target as Sprite;
mySprite.rotation += 1;
}
}
}
}