forked from: flash on 2015-7-6
forked from flash on 2015-7-6 (diff: 1)
ActionScript3 source code
/**
* Copyright tepe ( http://wonderfl.net/user/tepe )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zdoG
*/
// forked from tepe's flash on 2015-7-6
package {
import flash.display.Sprite;
import flash.events.*;
import flash.text.*;
public class FlashTest extends Sprite {
private var plr:Sprite;
private var tf1:TextField = new TextField();
public function FlashTest() {
// write as3 code here..
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyFunc);
plr = draw1();
addChild(tf1);
tf1.text = "text";
}
private function draw1():Sprite{
var s:Sprite = new Sprite();
addChild(s);
s.graphics.beginFill(0xff0000);
s.graphics.drawRect(20,20,20,20);
s.graphics.endFill();
return s;
}
private function keyFunc(e:KeyboardEvent):void{
tf1.text = e.charCode.toString();
if(e.charCode == 97){
plr.x -= 20;
}
if(e.charCode == 115){
plr.x += 20;
}
};
}
}