Actionscript Code:
package {
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
public class DocumentClass extends MovieClip {
private var car:Car;
public function DocumentClass() {
// constructor code
car = new Car();
addChild(car);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
}
public function keyPressed(event:KeyboardEvent) {
if (event.keyCode == 65) {
car.x -= 5;
}
}
}
}
Actionscript Code:
package {
import flash.display.MovieClip;
public class Car extends MovieClip {
public function Car() {
// constructor code
x = 200;
y = 300;
}
}
}
To test this you have to Active the Disable Keyboard Shortcuts from Control tab of the Flash Player.
marlopax