PDA

View Full Version : Using movie clips w key press function...


poz
06-05-2005, 02:35 AM
I am trying to put together a simplified version of the same sort of movement seen at pianographique but am having problems identifying the key ASCII... It simply is working for me at all...

I have just finished doing one of the tutorials here that deals with this sort of action and I have successfully managed to apply a movie clip to the key LEft arrow, but it doesn't seem to work for other characters...!!!

The code I'm using is as follows...

function moveStuff() {
arrowDepth=50;
arrowX=300;
arrowY=350;
if (Key.isDown(Key.LEFT)) {
this._x -= this.speed;
_root.attachMovie("arrow_mc","arrowMC",arrowDepth);
arrowMC._x=arrowX;
arrowMC._y=arrowY;
arrowMC._rotation=-90;
_root.attachMovie("bouncing_mc","bouncingMC",bouncingDepth);
bouncingMC._x=200;
bouncingMC._y=200;
}

This code is working with no problems... But when I try and assign an ASCII code to assign the function to a specific key it stops working completely. What is the proper way of typing the Ascii no???

Thanks!

prt1
06-05-2005, 08:28 AM
Just substitute KEY.LEFT with an ascii code
ie if (Key.isDown(87)) { tests for w being pressed

Look in Keyboard Keys and Keyboard values in help files