5fpsだけど30fps風に動かす
ヤングライオンコンペが18fps縛りだったんだけど
みんなヌルヌル動くヤツつくっててずるいなー
って思ったのでこういう方法もあるよ的なうっふん
package {
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.display.Sprite;
[SWF(frameRate='5')]
public class FlashTest extends Sprite {
private var _ef:Sprite;
private var _tm:Sprite;
private var _timer:Timer;
public function FlashTest() {
// write as3 code here..
_ef = addChild(new Sprite()) as Sprite;
_tm = addChild(new Sprite()) as Sprite;
_ef.graphics.beginFill(0x0000ff);
_ef.graphics.drawCircle(150,0,30);
_ef.graphics.endFill();
_tm.graphics.beginFill(0xff0000);
_tm.graphics.drawCircle(200,0,30);
_tm.graphics.endFill();
_ef.x = _tm.x = stage.stageWidth/2;
_ef.y = _tm.y = stage.stageHeight/2;
_timer = new Timer(33, 0);
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_timer.start();
addEventListener(Event.ENTER_FRAME, onEnter);
}
private function onTimer(evt:TimerEvent):void
{
_tm.rotation += 1;
evt.updateAfterEvent();
}
private function onEnter(evt:Event):void
{
_ef.rotation += 1;
}
}
}