actionScript3とおやつの会 2010.04.30 vol.5
♥0 |
Line 21 |
Modified 2010-05-03 18:04:43 |
MIT License
archived:2017-03-10 14:28:14
ActionScript3 source code
/**
* Copyright kwkd ( http://wonderfl.net/user/kwkd )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9u8a
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite {
private var _maru:Sprite;
public function Main() {
_maru = new Sprite();
_maru.graphics.beginFill(0xFF0000);
_maru.graphics.drawCircle(0,-200,10);
_maru.graphics.endFill();
_maru.x = stage.stageWidth/2; // ステージの大きさ/2で真ん中に配置
_maru.y = 465/2; // 上に同じく真ん中配置。ステージサイズ決め打ち指定でもOK!!
this.addChild(_maru);
this.addEventListener(Event.ENTER_FRAME,onEnter);
}
private function onEnter(event:Event):void {
var date:Date = new Date();
_maru.rotation = date.getSeconds()*6; // getSecondsで0〜60の値が帰ってくるので、6倍して360度指定
}
}
}