forked from: ErrorTest2

by yd_niku forked from ErrorTest2 (diff: 24)
♥0 | Line 47 | Modified 2009-05-14 15:43:30 | MIT License
play

ActionScript3 source code

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

// forked from yd_niku's ErrorTest2
// forked from yd_niku's ErrorTest
package {
    import flash.display.*;
    import jp.progression.core.commands.*;
    import jp.progression.commands.*;
    public class FlashTest extends Sprite {
        private var ball:Sprite;
        public function FlashTest() {
            // write as3 code here..
            ball = new Ball();
            
            new SerialList( null,
                new Prop( ball, { x:250, y: 250, alpha:0 } ),
                new AddChild( this, ball ),
                new SerialList( null, 
                    //Errorを発生するコマンド
                    new FadeIn( ball ).error(function():void{
                        // Errorの時の処理
                    }), // extends SerialList
                    //中断するとなぜかここでTypeErrorになるなあ…
                    new DoTweener( ball, {scaleX:3, scaleY:3, time:2 }  ),
                    new Trace("TEST")
                ).error( function(e:Error):void{
                    //このコマンドは中断する
                    this.interrupt();
                }),
                new DoTweener( ball, { x:100, y: 200, time:3 } ), 
                new DoTweener( ball, { alpha:0.0, time:3 } ),
                new RemoveChild( this, ball ),
                new Trace("TEST COMPLETE") 
            ).execute(); 
        }
    }
}


import flash.display.*;
import jp.progression.core.commands.*;
import jp.progression.commands.*;

internal class Ball extends Sprite{
    public function Ball(){
        graphics.beginFill(0x99CC66);
        graphics.drawCircle( 0, 0, 10 );
        graphics.endFill();
    }
}

internal class FadeIn extends SerialList{
    public function FadeIn( target:DisplayObject, initObject:Object=null ) {
        super(initObject,
            new DoTweener( target, { alpha:1.0, time:3 } ),
            new DoTweener( target, { x:400, y: 350, time:3 } ),
            new Func( function () :void{ throw new Error("FAILD!!"); } ),
            new Trace("FadeIn")
        );
    }
}

Forked