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

flash on 2011-4-30

Get Adobe Flash player
by yuugurenote 30 Apr 2011
/**
 * Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aPjF
 */

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

    [SWF(width=300,height=300,backgroundColor=0x000000,frameRate=60)]    
   
    public class FlashTest extends Sprite {
        var sw:Number=stage.stageWidth;
        var sh:Number=stage.stageHeight;
        var bw:Number;
        var speed:Number = 5;
        var speedX:Number = speed;
        var speedY:Number = 0;
        var myInt:Number =0;
        var mySprite:Sprite = new Sprite();
        public function FlashTest() {
            // write as3 code here..
            mySprite.graphics.beginFill(0xCCCCCC,1);
            mySprite.graphics.drawRect(0,0,15,15);
            mySprite.graphics.endFill();
            addChild(mySprite);
            bw=mySprite.width;
            
            mySprite.addEventListener(Event.ENTER_FRAME,xMove);
            function xMove(e:Event):void {
    
    //ζŠ˜γ‚ŠθΏ”γ—
    var r:Number = myInt * mySprite.width;
    
    mySprite.x+=speedX;
    mySprite.y+=speedY;
    if (mySprite.x+bw + r>sw) {
        mySprite.x=sw-bw -r;
        speedX=0;
        speedY=speed;
    }
    if (mySprite.y+bw+r>sh) {
        mySprite.y=sh-bw -r;
        speedX=-speed;
        speedY=0;
    }
    if (mySprite.x < 0)  {
        mySprite.x = 0;
        speedX=0;
        speedY=-speed;
    }
    if (mySprite.y <  0) {
        mySprite.y= 0;
        speedX=speed;
        speedY=0;
        myInt++;
    }
    if (myInt == 18) {
        myInt =0;
    }
}
        }
    }
}