AcydTrip
asked on
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
Paste your entire code here.
ASKER
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.
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.
ASKER
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.
ASKER