PDA

View Full Version : Keyboard object control


diakonas
11-27-2003, 09:29 AM
Hi there!

I have some problem with keyboard object control...

When I write down script with "_x --" or "_x -= speed" it works fine -> obejct move in -axis. When I write down "++", it works fine as well, but when I use "+= speed" it doesnt work, but I realy dont know why!?

Any suggestions?

Thanks a lot,
diak

ps - sorry for my english

divarch
11-27-2003, 10:03 AM
Post the code you are using, so other can look into it.

Cheers

diakonas
11-27-2003, 10:38 AM
here it is...



onClipEvent (load) {
speed = "10";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}



It is exactly the same just like line above within "-", but doesnt work...

divarch
11-27-2003, 10:51 AM
Lose the quotes "" on speed variable!

diakonas
11-27-2003, 10:59 AM
Hey! It works fine - thanks a lot!

----------
Ok, but why "left" side before worked?