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

Pomeranje loptice tastaturom

Get Adobe Flash player
by stamenkovski87 28 May 2015
    Embed
/**
 * Copyright stamenkovski87 ( http://wonderfl.net/user/stamenkovski87 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6c6P
 */

package {
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    
    public class FlashTest extends Sprite {
        private var lopta:Sprite;

        public function FlashTest() {
                init();}
        
        private function init():void{
            lopta = new Sprite();
            stage.addChild(lopta);
            lopta.graphics.beginFill(0xff0000);
            lopta.graphics.drawCircle(0,0,40);
            lopta.x = stage.stageWidth/2;
            lopta.y = stage.stageHeight/2;
            stage.addEventListener(KeyboardEvent.KEY_DOWN, onKBEvent);
         }
         
         private function onKBEvent (event:KeyboardEvent):void{
             switch(event.keyCode){
                 case Keyboard.UP:
                 lopta.y -=10;
                 break;
                 case Keyboard.DOWN:
                 lopta.y +=10;
                 break;
                 case Keyboard.LEFT:
                 lopta.x -=10;
                 break;
                 case Keyboard.RIGHT:
                 lopta.x +=10;
                 break;
                 default:
                 break;
                 }
             }
    }
}