forked from: forked from: ErrorTest2

by djakarta_trap forked from forked from: ErrorTest2 (diff: 8)
♥0 | Line 53 | Modified 2009-08-10 11:06:38 | MIT License
play

ActionScript3 source code

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

// forked from yd_niku's forked from: ErrorTest2
// 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.*;
    import flash.text.TextField;
    public class FlashTest extends Sprite {
        private var ball:Sprite;
        private var _tf:TextField;
        public function FlashTest() {
            // write as3 code here..
            ball = new Ball();
            _tf = new TextField();
            this.addChild(_tf);
            
            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(e:Error):void{
                        // Errorの時の処理
                        _tf.text = e.toString();
                        this.parent.executeComplete();
                    }), // 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")
        );
    }
}