is there someone else, who would either like to learn flash or can help a fellow programmer (switching after quite some years years of c/c++, python, ruby))
Happy to help if you have further questions.
A couple of notes about what you have there:
1) Binding things directly to the stage works, but is probably not a good idea for anything more complex than pong. I'd recommend making a Sprite, making it a child of the root using addChild() and then attaching all your event listeners and so on to that. Why is this good? Because when you remove it from the display list it then stops it from picking up further events. The main good thing about moving to Flash from C/C++ is that you no longer have to write vast blocks of boilerplate code (or heavyweight preprocessor macros) to carefully ref/deref, add/remove, create/destroy and so on. Let the garbage collector and the display list do the heavy lifting for you.
2) It looks a bit like you've been writing ActionScript straight into the frame? If so, I'd recommend working with classes instead. So all you have in the actual frame is something like:
var game:MyGameClass = new MyGameClass(this);
game.launch();
stop();
3) For most games it's more useful to be able to tell whether a key
is down than to receive an event when it's pressed. I'd recommend writing a helper class which manages keyboard status, but all you really need is an object. So you do something like this:
import flash.ui.Keyboard;
var keysDown:Object = new Object();
function keyDownHandler(ev:KeyboardEvent) {
var code:Number = ev.keyCode;
keysDown[code] = true;
}
function keyUpHandler(ev:KeyboardEvent) {
var code:Number = ev.keyCode;
delete keysDown[code];
}
function keyIsDown(code:Number):Boolean {
return Boolean(keyCode in keysDown);
}
gameScreen.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
gameScreen.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
// Usage example:
if (keyIsDown(Keyboard.SPACE)) {
// Fire laser!!!11!
game.addHugeLaserBolt(gun.x,gun.y);
game.audio.newSound("pewpewpew.mp3");
game.character.monocle.popOut();
}
i'd love to use something like Keycodes.UP though
Take a look at the properties declared in the flash.ui.Keyboard class.
And finally, due to limitations of the TIGS forum software, two rogue BBCode tags will appear after the end of my post. See if you can work out why...
[/code][/code]