Roopコマンドの練習 Roopコマンドを使ったfl.transitionsのyoyoみたいやつ flabaka forked:1favorite:0lines:52license : All rights reserved modified : 2009-03-02 22:02:59 Embed Tweet //Roopコマンドを使ったfl.transitionsのyoyoみたいやつ package { import flash.display.Sprite; import jp.progression.commands.*; import jp.progression.core.commands.*; public class Main extends Sprite { public function Main() { //シリアルリストインスタンス作成 var s:Sprite = new Sprite(); var loopList:SerialList = new SerialList(); var sList:SerialList = new SerialList(); //線の種類を決めておく s.graphics.lineStyle(3,0x000000); //コマンド登録 loopList.addCommand( new AddChild(this, s), function():void{ //BOXを描画 s.graphics.beginFill(0xFFFF33); s.graphics.drawRect(100,100,50,50); s.graphics.endFill(); }, new Wait(1000), new DoTweener(s,{x: 250,time:2}), new Wait(1000), new DoTweener(s,{x: 0,time:2}) ); //コマンド実行 sList.addCommand(new LoopCommand(loopList)); sList.execute(); } } } //northprintさんのループコマンドを使わせてもらう import jp.progression.commands.*; import jp.progression.core.commands.Command; import jp.progression.events.*; class LoopCommand extends Command{ private var _command:Command; public function LoopCommand(command:Command,initObject:Object = null){ super( _execute, _interrupt, initObject ); _command = command; } private function _execute():void{ _command.addEventListener(CommandEvent.COMMAND_COMPLETE,commandComp); _command.execute(); executeComplete(); } private function commandComp(e:CommandEvent):void{ _command.execute(); } private function _interrupt():void{ _command.removeEventListener(CommandEvent.COMMAND_COMPLETE,commandComp); interruptComplete(); } public override function clone():Command{ return new LoopCommand(_command); } } Code Fullscreen Preview Fullscreen Command SerialList CommandEvent.COMMAND_COMPLETE DoTweener Wait clone CommandEvent AddChild interruptComplete executeComplete addCommand execute removeEventListener time addEventListener Object Sprite sort new page view favorite forked pv235 forked from: Roopコマンドの練習 celm forked:0 favorite:0lines:52 (diff:1)