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

practice : bitmapdata,random

practice
Get Adobe Flash player
by StarLight_ 17 Apr 2012
    Embed
package {
    import flash.events.MouseEvent;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var A:Array = new Array()
            var i:int = 0
            var bd:BitmapData = new BitmapData(1,1,false,0X0000)
            function Random():void{
                for(i =0; i<A.length ; i+=1){
                    A[i].x = Math.random()*450
                    A[i].y = Math.random()*450
                }
            }
            for(i =0; i <10000 ; i+=1){
                var u:Bitmap = new Bitmap(bd)
                stage.addChild(u)
                A.push(u)
            }
            Random()
            function ef(e:Event):void{
                for(i = 0; i < A.length ; i+=1){
                    A[i].x += Math.random()*10-5
                    A[i].y += Math.random()*10-5
                }
            }
            stage.addEventListener('enterFrame', ef)
            function md(e:MouseEvent):void{
                Random()
            }
            stage.addEventListener('mouseDown',md)
        }
    }
}