flash on 2010-1-31
♥0 |
Line 33 |
Modified 2010-01-31 00:22:29 |
MIT License
archived:2017-03-20 12:54:14
ActionScript3 source code
/**
* Copyright hacker_9p8x8mco ( http://wonderfl.net/user/hacker_9p8x8mco )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/yCNJ
*/
package{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
[SWF(width="400",height="400",frameRate="30")]
public class Test extends Sprite{
private var re:Sprite;
public function Test(){
graphics.beginFill(0xcfcfff);
graphics.drawRect(50,50,300,300);
re = new Sprite();
re.graphics.beginFill(0x7f7fff);
re.graphics.drawRect(-200,100,200,200);
re.graphics.endFill();
addChild(re);
addEventListener(Event.ENTER_FRAME,rx);
re.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
re.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
}
private function rx(e:Event):void{
re.x += 4;
if (re.x > 600){
re.x = 0;
}
}
private function onMouseDown(evt:MouseEvent):void{
evt.target.startDrag();
}
private function onMouseUp(evt:MouseEvent):void{
evt.target.stopDrag();
}
}
}