PDA

View Full Version : small debugging help.


omega10mg
01-11-2003, 03:47 AM
this is the code i made (and something is wrong):

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
gotoAndPlay "standing"; }
else gotoAndPlay "crouching";
}

okey..so i am trying to make this happen, i made a MC with two frames one where i draw a guy standing and one where he's crouching.
I labeld the frames crouching and standing.
then i added the code above on my movie clip.
but i get this when i try to run it:

Scene=S01, Layer=Layer 1, Frame=1: Line 3: ';' expected
gotoAndPlay "standing"; }

Scene=S01, Layer=Layer 1, Frame=1: Line 4: ';' expected
else gotoAndPlay "crouching";

and i've tryed 100 of diffrent ways now.. and i am stuck..
I just want the **** to work..and what should happen..
well the dude should stand up when i press the UP key, and sit down again when i relese it.. but NOOOOOO! it dosent wanna work!
can anyone help me.. and i would be so thankfull!

civicparadox
01-11-2003, 03:56 AM
You might want to try two things. First try closing the onClipEvent call with another curly brace at the end. Second, try putting parens around standing and crouching. Goodluck!

civicparadox
01-11-2003, 03:58 AM
Oh wait, I take back the first suggestion, I didn't realize you didn't use braces for the else statement.

omega10mg
01-11-2003, 04:00 AM
okey.. did that...

now it looks like this:

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
gotoAndPlay ("standing"); }
else gotoAndPlay ("crouching");
}

one good thing is that i dont get an error.. but bad thing is that nothing happens.. what is wrong?

tg
01-13-2003, 03:46 PM
use tags to format your code: wrap as and /as with [] and put your code between the two tags. you will see you need to add a couple more }.
this:

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
gotoAndPlay ("standing"); }
else gotoAndPlay ("crouching");
}

should be:

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
gotoAndPlay ("standing");
} else{
gotoAndPlay ("crouching");
}
}