forked from: forked from: forked from: forked from: LoopList Sample

by 9re
♥0 | Line 51 | Modified 2010-06-27 08:41:23 | MIT License
play

ActionScript3 source code

/**
 * Copyright 9re ( http://wonderfl.net/user/9re )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/8KE5
 */

// forked from clockmaker's forked from: forked from: forked from: LoopList Sample
// forked from BMA_JAPAN's forked from: forked from: LoopList Sample
package {
    import flash.display.Sprite;
    import com.bit101.components.*;
    import flash.display.MovieClip;
    import flash.display.Shape;
    import jp.progression.casts.*;
    import jp.progression.commands.display.*;
    import jp.progression.commands.lists.*;
    import jp.progression.commands.managers.*;
    import jp.progression.commands.media.*;
    import jp.progression.commands.net.*;
    import jp.progression.commands.tweens.*;
    import jp.progression.commands.*;
    import jp.progression.data.*;
    import jp.progression.events.*;
    import jp.progression.scenes.*;
    
    public class Move_mc extends MovieClip {
        public function Move_mc() {            
            var shape:Shape = new Shape();
            shape.graphics.lineStyle(3, 0xff0000);
            shape.graphics.drawCircle(0, 0, 500);
            addChild(shape);
            
            var label:Label = new Label(this, 10,10, "hoge");
            var num:int;
            num = 0;
            var move_Array:Array  = new Array();
            move_Array[0] = [178.7, 128.1, 100, -30.6, 1];
            move_Array[1] = [178.7, 128.1, 100, 98.4, 1];
            move_Array[2] = [226.0, 162.0, 100, 227.4, 1];
            move_Array[3] = [178.7, 128.1, 100, 389.4, 1];
            move_Array[4] = [178.7, 128.1, 100, 517.4,1];
            
            new Prop(shape, { width:move_Array[num][0] , height:move_Array[num][1], x:move_Array[num][2], y:move_Array[num][3], alpha:move_Array[num][4] } ).execute();
            /*
            num++;
            var list:LoopList = new LoopList(0);
            list.addCommand(
                new Wait(1),
                function():void {
                    label.text = (list.getCommandIndex(this)).toString();
                    
                    num++;
                    if(num == move_Array.length ) num = 0;
                    
                    // Funcコマンドで更新した値を使いたい場合は、Funcコマンド内で利用する
                },
                new DoTweener(
                    shape,
                    { width:move_Array[num][0] , height:move_Array[num][1], x:move_Array[num][2], y:move_Array[num][3], alpha:move_Array[num][4], time:1 }
                )
            );
            */
            
            var list:LoopList = new LoopList;
            move_Array.forEach(
                function (propList:Array, $index:int, $arr:Array):void {
                    var prop:Object = { time : 1 };
                    (["width", "height", "x", "y", "alpha"]).forEach(function (propName:String, $$index:int, $$arr:Array):void {
                        prop[propName] = propList[$$index];
                    });

                    
                    list.addCommand(
                        function ():void {
                            label.text = $index.toString();
                        },
                        new DoTweener(shape, prop)
                    );
                }
            );
            list.execute();
        }
    }
}