PDA

View Full Version : why doesnt it play?!



Ravmaster
September 9th, 2006, 04:53 PM
if(Key.isDown(_root.ATTACKRIGHTKEY)){
if(_root.mcPLAYER.GROUNDED == true) {
if (_root.mcPLAYER.DIRECTION == "R") {
_root.mcPLAYER.gotoAndStop(12)
}
}
}

when i do press cntrl(ATTACKRIGHTKEY) frame 12 doesnt play what is in it it just stops on the first frame of the animation

this happens to me a lot i have no idea why any ideas?

REEFˇ
September 9th, 2006, 05:01 PM
function controlKeyDown() {
if (Key.isDown(Key.CONTROL) && _root.mcPLAYER.GROUNDED && _root.mcPLAYER.DIRECTION == "R") {
_root.mcPLAYER.gotoAndStop(12);
}
}
controlKey = new Object();
controlKey.onKeyDown = controlKeyDown;
Key.addListener(controlKey);
If you wanna use a variable to store the key code/name, make sure pre-define it beforehand like so:


var ATTACKRIGHTKEY = Key.CONTROL;

Ravmaster
September 9th, 2006, 05:12 PM
that doesnt work it stops the first frame in mcPLAYER

REEFˇ
September 9th, 2006, 05:19 PM
Well are you sure mcPLAYER.GROUNDED is defined to true & mcPLAYER.DIRECTION is defined to "R"? Is there any code that could be on frame 12 of mcPLAYER stopping it from staying in frame 12?

Ravmaster
September 9th, 2006, 05:20 PM
i tried your variable thingy aswell but it still didnt work when i do press control it plays the first frame in mcplayer through once and then stops

REEFˇ
September 9th, 2006, 05:22 PM
The variable thingy has nothing to do with mcPLAYER. The code I gave you should detect the control key just fine.

.FLA?

Ravmaster
September 9th, 2006, 05:32 PM
ok rapidshare should be ok since its a small file http://rapidshare.de/files/32542961/Sonic_The_Three_Orbs.fla
(704kb)

REEFˇ
September 9th, 2006, 05:39 PM
In frame two, the actions layer / actions window, right above line 227, include this:


ATTACKRIGHTKEY = Key.CONTROL;

Ravmaster
September 9th, 2006, 06:00 PM
it goes to the frame but stops on the first animtion frame again >.< (Gawd AS is annoying sometimes)