I just got started learning AS3.
Let's say I have two textfields on my sprite.
I like to move textfield 1 when I press left or right arrow keys, but I also want to move textfield 2 when I press space while textfield 1 is moving like...an airplay game (you can shoot a missile while you're moving).
I really like to post my source code...but I actually have no idea where to begin.
the following code moves textfield 1 when I press arrow keys...
my code snippet:
private function keyHandler(event:KeyboardEvent):void
{
switch(event.keyCode)
{
case 38:
this._txt.y -= 10;
break;
case 40:
this._txt.y += 10;
break;
case 39:
this._txt.x += 10;
break;
case 37:
this._txt.x -= 10;
break;
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…