flash on 2010-3-6
♥0 |
Line 27 |
Modified 2010-03-06 18:42:03 |
MIT License
archived:2017-03-20 01:21:05
ActionScript3 source code
/**
* Copyright ushisantoasobu ( http://wonderfl.net/user/ushisantoasobu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/uAex
*/
package {
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
this. graphics.beginFill(0x000000);
this.graphics.drawRect(10,10,90,90);
var hero:Hero = new Hero();
this.addChild(hero);
}
}
}
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.text.TextField;
import flash.ui.Keyboard;
class Hero extends Sprite{
public function Hero():void{
this.graphics.beginFill(0x343434);
this.graphics.drawRect(10,10,30,30);
this.addEventListener(KeyboardEvent.KEY_DOWN, moveUp);
}
private function moveUp(event:KeyboardEvent):void{
if(event.keyCode == Keyboard.E){
this.x += 30;
}
}
}