ぷるぷる
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/t3XJ
*/
////////////////////////////////////////////////////////////////////////////////
// ぷるぷる
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
[SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="60")]
public class Main extends Sprite {
private var rect:Sprite;
public function Main() {
//Wonderfl.capture_delay(1);
init();
}
private function init():void {
rect = new Sprite();
addChild(rect);
rect.graphics.beginFill(0x000000);
rect.graphics.drawRect(-100, -100, 200, 200);
rect.graphics.endFill();
rect.x = 232;
rect.y = 232;
rect.addEventListener(MouseEvent.MOUSE_OVER, rollOver, false, 0, true);
rect.addEventListener(MouseEvent.MOUSE_OUT, rollOut, false, 0, true);
}
private function rollOver(evt:MouseEvent):void {
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
}
private function rollOut(evt:MouseEvent):void {
removeEventListener(Event.ENTER_FRAME, update);
rect.x = 232;
rect.y = 232;
rect.rotation = 0;
}
private function update(evt:Event):void {
rect.x = 232 + Math.random()*2 - 1;
rect.y = 232 + Math.random()*2 - 1;
rect.rotation = Math.random()*2 - 1;
}
}
}