The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 ViewsGuys, I think I'm going crazy. My stop action won't work. You heard right, and no, I'm not a noob. I honestly think this is Flash's fault but I really, really hope I'm wrong. Facts:
>>> The problem itself is that the Movie Clip won't stop. It just plays through, but stops at the end, which is weird because there isn't even a stop action at the end.
>>> I'm using Flash 8 and ActionScript 2.0.
>>> I have a keyframe in the dialogue every other frame because I want the isToggled script to bring the player to the next screen when it's both pressed and lifted.
>>> I have a Movie Clip named Scene 1. On the first frame of that Movie Clip is the action stop(); just a plain stop action, nothing more. I have a screenie of the Movie Clip at the bottom. (I considered the name could be confusing Flash and changed it, but it didn't work that way, either.)
>>> On the outside of the Movie Clip I have these actions:
onClipEvent(enterFrame){
if(Key.isToggled(Key.SPACE)){
this.nextFrame();
}
}
I've tried removing the 'this.' and I've tried it with it, but it won't work either way. It's gotta be this script because I've tried it without the script at all and it's fine.
>>> In case you were wondering, I only have one frame.
>>> And finally, here is a screenie of the timeline within the Movie Clip:
If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)
Really, really impressive, this is the first time I've ever seen someone break stop(); in my years of Flash : o
I wouldn't know how to solve it though, have you tried _root.movieclipname.stop(); on the main timeline or gotoAndStop(1); on the second frame in the movieclip, just to see what works and what doesn't?
I also wanted to add that sometimes it stops and sometimes it doesn't. It does or doesn't depending on how many times you've pressed the spacebar before exporting it, which makes absolutely no sense. And even when it does stop, pressing space doesn't make the cutscene advance, but makes it play all the way through.
have you tried _root.movieclipname.stop(); on the main timeline
_root. on the main timeline? I tried it with and without the _root. and it didn't work.
or gotoAndStop(1); on the second frame in the movieclip,
gotoAndStop(1); kept it on the first frame, but now it won't advance at all.
I'm about ready to tear my hair out because I'm in a huge collaboration with 4 other people and I'm the only programmer. I can't let them down :(
If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)
At 2/21/09 09:04 PM, Kwing wrote:
have you tried Key.isDown instead of Key.isToggled
awww
It wouldn't work because then it would skip through the frames way too fast, especially because my framerate is 30.
GUYS COME ON!!
If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)
toggled is a wonkey thing to use. I don't even know how it works. But think about it, your movieclip always seems to play, even when you have something telling it to go back to the first frame and stop, it always wants to move forward, always want to go to the... next frame :o!
Problem is you have onClipEvent(enterFrame), and flash thinks space is always toggled, therefore it's always doing the nextFrame();
From the looks of it, it seem you want them to go to the next line of dialogue when space is pressed, if so, just use this:
on(keyPress "<Space>"){
nextFrame();
}
This will only do the next frame each time the space is pressed. If someone holds down space, then it will wait a second, and then do nextFrames repeatedly, it works exactly like holding down a key on the keyboard.
I considered that, but I didn't want anyone to skip my cutscenes. Though I suppose if I don't have a choice, I don't have a choice (wow x=x logic).
If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)
At 2/21/09 09:31 PM, Kwing wrote: It wouldn't work because then it would skip through the frames way too fast, especially because my framerate is 30.
GUYS COME ON!!
then use a variable! if space is pressed and var is false do this stuff and make the variable true when you release the key the variable is false again
COME ON MAN!!!!!!!
awww
1. isToggled is for keys that can be toggled, example caps lock, num lock
2. why are you using AS1...
3. the mc, is probably set to loop 0 times, thats why theres no need for a stop
Make a new layer, blank and no key frames, only frames till the end. Then try this script:
onEnterFrame = function (){
if(i==undefined){
i = getTimer();
}
if(getTimer()>i+5000){
i = getTimer();
gotoAndStop(_currentFrame+1);
}
}; At 2/21/09 09:47 PM, Kwing wrote: I considered that, but I didn't want anyone to skip my cutscenes. Though I suppose if I don't have a choice, I don't have a choice (wow x=x logic).
Wait.. So you want people to view your cutscenes, but you want the spacebar to advance the frame?
I have no idea what you want to do..
Oops, I just realized, you mean you want them to press space bar to go to the next piece of dialogue, but not be able to hold it down to skip the scene? If so, this will make it so holding the spacebar does nothing, they will need to let go, and press it again each time:
onClipEvent(enterFrame){
//Only allow space press once until it's lifted
if(!spacePressed && Key.isDown(Key.SPACE)){
spaceDown = true;
spacePRessed = true;
}
//When space is released, allow it to be pressed again next time
if(!Key.isDown(Key.SPACE)){
spacePressed = false;
}
//When space is first pressed, advancee the frame
if(spaceDown){
spaceDown = false;
nextFrame();
}
}
Gah, sorry for triple post, just noticed a typo in the code, spelled one of the variables wrong. Here:
onClipEvent(enterFrame){
//Only allow space press once until it's lifted
if(!spacePressed && Key.isDown(Key.SPACE)){
spaceDown= true;
spacePressed = true;
}
//When space is released, allow it to be pressed again next time
if(!Key.isDown(Key.SPACE)){
spacePressed = false;
}
//When space is first pressed, advancee the frame
if(spaceDown){
spaceDown = false;
nextFrame();
}
}
A simpler way is just this:
if(Key.isDown(Key.SPACE) ){
if(!spacePress){
spacePress = true;
nextFrame();
}
}else{
spacePress = false;
} Holy crap I already got my answer, guys!
/thread
If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)