|
-
[RESOLVED] Sound not playing?
Hi there, in my coding I have this function:
Actionscript Code:
if(!mainJumping){ if(Key.isDown(38) || Key.isDown(87)){ if(!mainOnLadder){ mainJumping = true; jumpSpeed = jumpSpeedLimit*-1; mcMain._y += jumpSpeed; jumpsound = new Sound(this); jumpsound.attachSound("jump"); jumpsound.start(); } } }
and it all worked fine.
Then I added a pause menu, and thus added this in the onEnterFrame function (containing this jump function):
so that everything would only happen when the game isn't paused. As a result the sound won't play... This is the only function I added to the script (well, aside from the actual variable: var gamePaused:Boolean = false). Everything else, including physically jumping, works fine. What's wrong?
-
Prid - Outing
Is that code in a nested movieclip, while the actual Boolean Variable on another level? Try !_root.gamePaused and also try tracing gamePaused, to see if it exists or not and its current value!
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Nope, the code is in the same layer as the boolean variable - an actions layer. I tried !_root.gamePaused anyway, no different 
gamePaused is working, as everything else works within the onEnterFrame - moving, jumping, etc. You can see in the code I pasted where it says 'mainJumping = true', saying that the character jumps - this function works. It seems only the sound won't play.
Do booleans stop sounds or something?
-
Prid - Outing
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Okay, here's a strimmed-down version. The scripting is exactly the same, I just made all the shapes and stuff basic 
Thanks for your time!
EDIT: I've re-posted it below as an earlier version.
Last edited by JimbobD; 02-05-2012 at 05:15 PM.
-
Prid - Outing
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Sorry for the delay, here it is - it's CS4 if that's okay. I can't get it any earlier through the program itself
Last edited by JimbobD; 02-07-2012 at 01:18 PM.
-
Prid - Outing
oh, I feel so stupid when I realized what was wrong -.-*
remove this from this:
Code:
jumpsound = new Sound(this);
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Thank you so much, I can't believe I didn't see that!
-
Prid - Outing
haha, we all overlook those obscure mistakes, so no problem
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|