I would do something along the lines of the way before with the variable, but a bit different.
onLoad = function(){
holdvar = 0
}
onEnterFrame = function(){
if(Key.isDown(87)){
holdvar++
}
if(holdvar>=1 && (holdvar <=9 && (!Key.isDown(87)))){ //------------------ Change the 9 if you want a shorter time to count as if you just press it.
_root.gotoAndStop(2)
}
if(holdvar>=10 && (!Key.isDown(87))){ //------------------ If you change the 9 in the few lines above, you have to make this 10 one number above it.
_root.gotoAndStop(6)
}
}
It calls a variable equaling 0, and when the key is down, it adds. You can change numbers in the lines marked with ------------ to get say maybe you want a shorter time to be counted as pressed than 10.
If you want to see how this works, make 6 frames, on the first frame, put
stop();
, copy and paste the code i gave you above, and make a dynamic text box with the variable holdvar (YOU DO NOT NEED THIS DYNAMIC TEXT BOX, IT'S JUST TO VISUALLY SHOW WHAT IT DOES).
On the 2nd frame, put the number 2, and on the 6th frame, put the number 6.
You will see the 0 add by 1 when W is down.
Questions? Feel free to ask.