Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Go to another frame when a frame is reached

I'm waaaaay over my head here, but I'm in it too far to back out.  Here's the situation I need help with,

I need to have a series of transitions set up, click a button and run through x number of frames, and upon reaching the last frame, go to another frame depending on what button was clicked.

In other words, if you click "product" you go to frame 50 and play, it runs to frame 70, then based on what button you clicked, goes to like frame 90 and plays, or 110 and plays, or 130 and plays, then stops when it gets to the end.

Now, in pseudocode, I'd write it out like this,

home = 1, news = 2, product = 3, support = 4

product is clicked, set variable to 3, go to frame 50, play to 70, at frame 70 determine what variable is, then if 1 go to and play frame 30, if 2...if 3 gotoAndPlay frame 130, if 4....

Basically, I need to know what action to put in the button, and what action to put at frame 70 to determine the above pseudocode.  500 because I'm an idiot that got in over my head and need bailed out fast.
0
AcydTrip
Asked:
AcydTrip
  • 4
  • 2
1 Solution
 
onFocusCommented:
Hi.
You should set a variable that holds the pseudocode.
For example:

In the frame where your buttons are:
var myVar=1;
products_btn.onPress=function(){
      myVar=3;
      gotoAndPlay(50);
}
//the same for the other buttons with the correct values for myVar and gotoAndPlay()


In frame 70:
if(myVar==1){
      gotoAndPlay(30);
}else if(myVar==2){
      gotoAndPlay(80);
}else if(myVar==3){
      gotoAndPlay(130);
}else if(myVar==4){
      gotoAndPlay(180);
}
0
 
AcydTripAuthor Commented:
THANKS!!!  YOU ROCK!!!  Thank you very much for the quick answer.  I'm finding Flash interesting, but intimidating.
0
 
AcydTripAuthor Commented:
PROBLEM!!

I put this in place, and when I go to test it, I get

**Error** Scene=Scene 1, layer=nav, frame=1:Line 2: Operator '=' must be followed by an operand
          myVar=1;

**Error** Scene=Scene 1, layer=nav, frame=1:Line 1: Statement must appear within on handler
     btn_image.onPress=function(){

**Error** Scene=Scene 1, layer=nav, frame=1:Line 3: Syntax error.
          gotoAndPlay(20);

**Error** Scene=Scene 1, layer=nav, frame=1:Line 2: Operator '=' must be followed by an operand
          myVar=2;

**Error** Scene=Scene 1, layer=nav, frame=1:Line 1: Statement must appear within on handler
     btn_image.onPress=function(){

**Error** Scene=Scene 1, layer=nav, frame=1:Line 3: Syntax error.
          gotoAndPlay(40);

**Error** Scene=Scene 1, layer=nav, frame=1:Line 2: Operator '=' must be followed by an operand
          myVar=3;

**Error** Scene=Scene 1, layer=nav, frame=1:Line 1: Statement must appear within on handler
     btn_image.onPress=function() {

**Error** Scene=Scene 1, layer=nav, frame=1:Line 3: Syntax error.
          gotoAndPlay(60);

**Error** Scene=Scene 1, layer=nav, frame=1:Line 2: Operator '=' must be followed by an operand
          myVar=4;

**Error** Scene=Scene 1, layer=nav, frame=1:Line 1: Statement must appear within on handler
     btn_image.onPress=function(){

**Error** Scene=Scene 1, layer=nav, frame=1:Line 3: Syntax error.
          gotoAndPlay(80);

**Error** Scene=Scene 1, layer=nav, frame=1:Line 2: Operator '=' must be followed by an operand
          myVar=5;

**Error** Scene=Scene 1, layer=nav, frame=1:Line 1: Statement must appear within on handler
     btn_image.onPress=function(){

**Error** Scene=Scene 1, layer=nav, frame=1:Line 3: Syntax error.
          gotoAndPlay(100);

**Error** Scene=Scene 1, layer=actions, frame=29:Line 2: Syntax error.
          gotoAndPlay(10);

**Error** Scene=Scene 1, layer=actions, frame=29:Line 3: Unexpected '}' encountered
     }else if(myVar==2){

**Error** Scene=Scene 1, layer=actions, frame=49:Line 2: Syntax error.
          gotoAndPlay(10);

**Error** Scene=Scene 1, layer=actions, frame=49:Line 3: Unexpected '}' encountered
     }else if(myVar==2){

**Error** Scene=Scene 1, layer=actions, frame=69:Line 2: Syntax error.
          gotoAndPlay(10);

**Error** Scene=Scene 1, layer=actions, frame=69:Line 3: Unexpected '}' encountered
     }else if(myVar==2){

**Error** Scene=Scene 1, layer=actions, frame=89:Line 2: Syntax error.
          gotoAndPlay(10);

**Error** Scene=Scene 1, layer=actions, frame=89:Line 3: Unexpected '}' encountered
     }else if(myVar==2){

**Error** Scene=Scene 1, layer=actions, frame=109:Line 2: Syntax error.
          gotoAndPlay(10);

**Error** Scene=Scene 1, layer=actions, frame=109:Line 3: Unexpected '}' encountered
     }else if(myVar==2){

Total ActionScript Errors: 25        Reported Errors: 25
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
onFocusCommented:
Paste your entire code here.
0
 
AcydTripAuthor Commented:
Forgive my ignorance, but I'm not sure how to display it all in one shot.

What I have is this

if(myVar==1){
     gotoAndPlay(10);
}else if(myVar==2){
     gotoAndPlay(30);
}else if(myVar==3){
     gotoAndPlay(50);
}else if(myVar==4){
     gotoAndPlay(70);
}
in 5 frames

and this in 5 others.

on(release){
     gotoAndPlay(20);
      myVar=1; 
}


I changed it to this while trying things out, I dropped 5 errors I'm down to 20 now.

If there's a way to display all of the script from the whole thing, please let me know, I'd be more than happy to post it.
0
 
AcydTripAuthor Commented:
Hey, no worries, it works.  I don't know what the deal is, I got errors, I got errors, I typed EXACTLY the same code into a new file, worked perfect.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now