Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-04-2008, 03:01 PM   #1
B_1
Registered User
 
Join Date: Mar 2008
Posts: 7
Red face How to move to nextframe using frame labels

I too am also a nOOb - especially AS3.
Have a simple 7 frame project - where we start with frame one, and after frame one is finished by clicking ENTER, the movie shoud got to frame two via: nextFrame ();

It does it for going to frame 2 and 3 and 4 and 5 - but it always skips frame 6, and goes on to the last frame 7.

It makes no sense. So want to know how we can change it so that if each frame has a Frame Label, we can do the same process of moving from frame to frame ( one frame at a time).

All help welcome ! Thanks !!!
B_1 is offline   Reply With Quote
Old 05-04-2008, 03:37 PM   #2
Mazoonist
Site Contributor
 
Mazoonist's Avatar
 
Join Date: Jun 2006
Posts: 3,160
Send a message via AIM to Mazoonist
Default

I'm not sure if this is exactly what you're looking for, but this topic came up once before on these forums, and I made an example fla file wherein you can click anywhere on the stage and advance to next frame label. Of course, you could easily modify it to requiring a click on a button instead of the stage. I'm attaching it, maybe it'll help you.
Attached Files
File Type: zip seek_next_label.zip (5.7 KB, 355 views)
__________________
My Tutorials * My Website
Mazoonist is offline   Reply With Quote
Old 05-04-2008, 10:39 PM   #3
B_1
Registered User
 
Join Date: Mar 2008
Posts: 7
Default

Hi - thanks for the idea - but being so new, am having difficulty incorporating it into the simplistic quiz we are doing as a project. I have pastec the ACtion Script for Frames 1 and 2 below. Frames 3 through 6 are the same as Frame 2 - with the exception that DoStuff becomes DoStuff3, DoStuff4, etc. They work fine. But for whatever reason, on Frame 5, it skips Frame 6 and goes to Frame 7 - which is the score summary page. Very weird.
================================================== =
Action - Frame 1:

stop();
enter_btn.addEventListener(MouseEvent.CLICK,doStuf f);
var score:Number = 0;
var answer:String;
function doStuff (event:MouseEvent):void
{
if (rb2_mc.selected == true)
{
score +=10;
answer = "Correct";
score_txt.text = String(score);
nextFrame ();
}
else
{
answer = "Incorrect";
nextFrame ();
}
enter_btn.removeEventListener(MouseEvent.CLICK,doS tuff);
}
================================================== ===
Action Frame 2 (etc):
stop();
score_txt.text = String(score);
out_txt.text = answer;
enter_btn.addEventListener(MouseEvent.CLICK,doStuf f2);

function doStuff2 (event:MouseEvent):void
{
if (rb3_mc.selected == true)
{
score +=10;
answer = "Correct";
score_txt.text = String(score);
nextFrame ();
}
else
{
answer = "Incorrect";
nextFrame ();
}
enter_btn.removeEventListener(MouseEvent.CLICK,doS tuff2);
}
================================================== ============
Have no idea why Frame 5 always skips Frame 6 and moves to Frame 7.

Any ideas - most welcome !!
B_1 is offline   Reply With Quote
Old 05-04-2008, 11:01 PM   #4
Mazoonist
Site Contributor
 
Mazoonist's Avatar
 
Join Date: Jun 2006
Posts: 3,160
Send a message via AIM to Mazoonist
Default

Is there a stop() command on frame 6 also?
__________________
My Tutorials * My Website
Mazoonist is offline   Reply With Quote
Old 05-05-2008, 12:00 AM   #5
B_1
Registered User
 
Join Date: Mar 2008
Posts: 7
Default

Yes, therre is - I 've pasted Frame 6 actions below:
ActionScript Code:
stop(); score_txt.text = String(score); out_txt.text = answer; enter_btn.addEventListener(MouseEvent.CLICK,doStuff6); function doStuff6 (event:MouseEvent):void {     if (rb3_mc.selected == true)     {         score +=10;         answer = "Correct";         score_txt.text = String(score);             }     else     {         answer = "Incorrect";     }     enter_btn.removeEventListener(MouseEvent.CLICK,doStuff6); } gotoAndStop(7);
B_1 is offline   Reply With Quote
Old 05-05-2008, 12:36 AM   #6
Mazoonist
Site Contributor
 
Mazoonist's Avatar
 
Join Date: Jun 2006
Posts: 3,160
Send a message via AIM to Mazoonist
Default

There's your problem. That last command:
gotoAndStop(7);

Regardless of whether you told the playhead to stop() on the first line, on the last line you've just told it to gotoAndStop on frame 7. The computer does whatever you tell it to. And blazingly fast, too, so you never even see frame 6.
__________________
My Tutorials * My Website
Mazoonist is offline   Reply With Quote
Old 05-05-2008, 01:10 AM   #7
B_1
Registered User
 
Join Date: Mar 2008
Posts: 7
Default

Thanks - it turned out to be a combination, I think - but the code that finally worked is:
ActionScript Code:
stop(); score_txt.text = String(score); out_txt.text = answer; enter_btn.addEventListener(MouseEvent.CLICK,doStuff6); function doStuff6 (event:MouseEvent):void {     if (rb3_mc.selected == true)     {         score +=10;         answer = "Correct";         score_txt.text = String(score);         nextFrame ();     }     else     {         answer = "Incorrect";         nextFrame ();     }     /*enter_btn.removeEventListener(MouseEvent.CLICK,doStuff6)*/; } gotoAndStop (6);
Appreciate all your good and quick replies !!! Thanks !!
B_1 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
frame 3 is having an identity crisis sparky_hd ActionScript 2.0 4 09-27-2006 10:00 PM
move mask and frame.... help!!! Wildmac ActionScript 2.0 2 07-24-2005 03:55 PM
Compare frame labels ? pcarini ActionScript 2.0 4 02-26-2005 07:39 AM
frame labels and variables: gotoAndPlay isabelstripes ActionScript 1.0 (and below) 1 02-14-2003 12:38 AM
Frame labels -> Frame numbers leaverk ActionScript 1.0 (and below) 2 07-12-2002 04:09 PM


All times are GMT. The time now is 08:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.