In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

[Tween24 ver2.0] manualUpdate() Test

135℃ごとに一時ストップしながら進む
Get Adobe Flash player
by romatica 26 Sep 2012
/**
 * Copyright romatica ( http://wonderfl.net/user/romatica )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ovn1
 */

package
{
    import a24.tween.Tween24;
    import a24.util.Align24;

    import flash.display.Sprite;
    import flash.events.Event;

    [SWF(backgroundColor="#FFFFFF", frameRate="60", width="465", height="465")]
    /**
     * 
     */
    public class TestTween24v2 extends Sprite
    {
        private var box : Sprite;
        private var _tween : Tween24;

        public function TestTween24v2()
        {
            box = addChild(new Box()) as Box;
            
            _tween = Tween24.loop(0
                 , Tween24.tweenCount(box, 60).$$rotation(90).align(Align24.BOTTOM_RIGHT)
                 , Tween24.tweenCount(box, 60).$$rotation(90).align(Align24.TOP_RIGHT)
                 , Tween24.tweenCount(box, 60).$$rotation(90).align(Align24.TOP_LEFT)
                 , Tween24.tweenCount(box, 60).$$rotation(90).align(Align24.BOTTOM_LEFT)
            );
            _tween.manualPlay();
            addEventListener(Event.ENTER_FRAME, onEnter);
        }

        private var cnt : int = 0;
        private  var flag : Boolean = false;

        private function onEnter(event : Event) : void
        {
            if (flag) _tween.manualUpdate();
            
            if (cnt >= 90 ) {
                flag = !flag;
                cnt = 0;
            }
            cnt++;
        }
    }
}
import flash.display.GradientType;
import flash.display.SpreadMethod;
import flash.display.Sprite;
import flash.geom.Matrix;

class Box extends Sprite
{
    public function Box()
    {
        var gradMrx : Matrix = new Matrix();
        gradMrx.createGradientBox(50, 50, Math.PI / 2, 0, 0);
        this.graphics.beginGradientFill(GradientType.LINEAR, [0xffe76f, 0x000000], [1, 1], [0, 255], gradMrx, SpreadMethod.PAD);
        this.graphics.drawRect(0, 0, 50, 50);
    }

}