|
-
Simple yet can remember
on a button im using this code:
Actionscript Code:
on (keyPress "1") {
this.movie1.gotoAndPlay("2");
}
I want the user to be able to press "1" again but this time it either resumes playing from the next frame OR gotoand Play another fram in the same movie.
How would i do this. Many thanks you kind people
-
Prid - Outing
On your frame actions, type this:
by this, we create a boolean variable (variable consisting of two values, TRUE and FALSE), and will turn it to TRUE once "1" has been pressed once, and then execute codes according to which value that variable has. So change your button code to this:
Actionscript Code:
on (keyPress "1") { if(secondHit == false){ this.movie1.gotoAndPlay("2"); } else { // in other words, if it's equals to FALSE // do something else } }
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Hi , thanks for helping.... However im not getting this to work at present..
on frame one (on frame actions) I have this
Actionscript Code:
secondHit = false; stop();
THen on the button I have this:
Actionscript Code:
on (keyPress "1") { if(secondHit == false){ this.movie1.gotoAndPlay("2"); } else { this.movie1.gotoAndPlay("31"); } }
The first animation still works on the first press but on second press it replays the same animation (when it should be playing frame 31)
-
Prid - Outing
oh, I AM SO DUMB Dx
I forgot to turn the secondHit variable to TRUE :P:P:P:P:P
Actionscript Code:
on (keyPress "1") { if(secondHit == false){ this.movie1.gotoAndPlay("2"); secondHit = true; } else { this.movie1.gotoAndPlay("31"); } }
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
ah lol.
When i fix my PC again I will try again, looks like it will work.
-
Hello again. That works a treat. Can you see if you can help with a final adjustment...
when I press "1" it does this:
this.movie1.gotoAndPlay("2");
When I press "1" again it does this:
this.movie1.gotoAndPlay("31");
When I press "1" again it does this:
this.movie1.gotoAndPlay("31");
Is it possible it can alternate so that if I press "1" it plays from frame 2
press again it plays from frame 31
press again it plays from frame 1
press again it plays from frame 31
etc etc
THANK YOU THANK YOU THANK YOU
-
actually...... Another issue has cropped up as i have more than one button. Can i send you a swf/upload a swf so I can explain better
-
sorry to spam....But i decided to turn my brain on and type this:
Actionscript Code:
oneHit = false; twoHit = false;
stop();
then i have 2 buttons playing 2 movies
Actionscript Code:
on (keyPress "1") { if(oneHit == false){ this.movie1.gotoAndPlay("2"); oneHit = true; }else { this.movie1.gotoAndPlay("31"); } }
and button 2
Actionscript Code:
on (keyPress "2") { if(twoHit == false){ this.movie2.gotoAndPlay("2"); twoHit = true; } else { this.movie2.gotoAndPlay("31"); } }
So i think ALL fixed now!
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
|