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

forked from: [1日1Wonderfl] 8日目:a practice of BetweenAS3

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

// forked from yd_niku's [1日1Wonderfl] 8日目:a practice of BetweenAS3 
package {
    import flash.display.Sprite;
    import flash.events.*;
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.tweens.ITween;
    import org.libspark.betweenas3.easing.*;
    [SWF(backgroundColor='0x00ffff')]
    public class FlashTest extends Sprite {
        public function FlashTest() {
            createParticle();
            stage.addEventListener( MouseEvent.CLICK, onclick );
        }
        private function onclick(e:Event) :void {
         //   while( numChildren > 0) removeChildAt(0);    
         // You can actually just say this
             while(numChildren) //Any values that are not: undefined, null, NaN, 0, false - equal true
                 removeChildAt(0);
            createParticle( Math.random() * 1000+300 );
        }
        public function createParticle( cnt:uint = 400 ):void {
            var tList:Array = [];
            for( var i:int=0; i<cnt; ++i ) { 
                var ball:Sprite = new Ball( Math.random()*6, 0xFF*(i/cnt)<<16| 0x0066 );
                addChild( ball );ball.x = ball.y = 230;
                ball.alpha = 1;
                var a:Number= (i*cnt) / Math.PI * 2;
                var radius:Number = 225
                var delay:Number = i/cnt * 2;
                var tx:Number=Math.cos( a )* radius;
                var ty:Number=Math.sin( a )* radius;
                var t1:ITween = BetweenAS3.tween( ball, { x:tx+230, y:ty+230 }, {x: 230, y: 230}, 5, Circ.easeInOut, delay );
                var t2:ITween = BetweenAS3.tween( ball, { alpha: 1 }, {alpha: 0}, 1, null, delay );                
                var t:ITween = BetweenAS3.parallel.apply( null, [t1,t2])
                
                t.stopOnComplete = false;
                t.gotoAndPlay(0);
            }
            
         //   t.stopOnComplete = false;
        }
    }
}

import flash.display.*;
internal class Ball extends Sprite{
    public function Ball( r:Number=4, c:uint =0x003366 ) {
        graphics.beginFill( c);
        graphics.drawCircle( 0, 0, r );
        graphics.endFill();
        
    }
}