ForumsProgramming ForumA Problem whit KeyBoard Events

5 2958
SeoMX
offline
SeoMX
89 posts
Nomad

I began making games a few days ago and everything was going OK, Nut when I test my game the is a yellow line surrounding my symbol, and when I click somewhere else the line disappears and so does my control over the missile!! I have seen my code a couple of time and I can't explain or fix this issue!!
Can someone help me??

  • 5 Replies
SeoMX
offline
SeoMX
89 posts
Nomad

Oh I'm using ActionScript 3!

dank
offline
dank
986 posts
Peasant

Can we see the code/source at least?

SeoMX
offline
SeoMX
89 posts
Nomad

var speed = 9;

missile.addEventListener(MouseEvent.CLICK, change_focus);
function change_focus(MouseEvent) {
stage.focus = missile;
}

function key_event_handler(event:KeyboardEvent):void {


missile.tabEnabled = true;
missile.buttonMode = true;
}
stage.focus = missile;

missile.addEventListener(KeyboardEvent.KEY_DOWN, missile_control);

function missile_control(event:KeyboardEvent):void {
var key = event.keyCode;
switch (key) {
case Keyboard.LEFT :
missile.x -= speed;
break;
case Keyboard.RIGHT :
missile.x += speed;
break;
}
}

Here is the whole code

dank
offline
dank
986 posts
Peasant

Try going to Control > Disable Keyboard Shortcuts in the player and see if that fixes it.

imthebest
offline
imthebest
1,690 posts
Nomad

nice lmao

Showing 1-5 of 5