Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jump to a scene from inside a movie 1

Status
Not open for further replies.

camelman

Programmer
May 31, 2001
32
0
0
ZA
I have created 2 scenes (scene1, scene2)
Inside scene1 I have placed a movie.
Withing that movie I have a button that must run scene2.
I have tried using

gotoAndPlay ("scene2", 1);
_root.gotoAndPlay ("scene2", 1);

but all these seem to do is jump me to the first frame of scene2.

How do I get scene3 to run.
My whole navigation depends on it (as well as my sanity)
I will idolise anyone who can help me.
 
Well you'll be happy to know that you are on the right track. In fact you are right there the only thing you need to do now is assign the frame number that you want the button to go to in the scene (scene2). So:

on (press) {
gotoAndPlay("scene2", 25);// would equal go to scene 2 frame 25 and play.
}


Hope that helps
 
A bit confusing!
You said 2 scenes... And you want to play scene 3?

Where should this mc in scene 1 take you exactly?
mywink.gif
ldnewbie
 
Sorry guys, firstly I made a typo.
I meant to say "How do I get scene2 to run.", not scene 3.
I am trying to jump to frame 1 of scene 2 so I would have
thought that

gotoAndPlay("scene2", 1); would have worked fine.
_root.gotoAndPlay ("scene2", 1); was a last resort but it didn't work either.

Thanks for the quick replies but I am still stuck.

ps: what is an mc ?

 
Me thinks there is more to this than there appears.

You said above that all you were getting was a jump to scene2 frame 1. I am gathering that is not what you are getting, but rather it is your goal?

I think we need to have a better understanding of the way that you have constructed your Flash file to help you out.
 
We are jumping and screaming here!! We got it working!!!
I created a function in scene one that jumped to whatever scene i pass it, and called that function from within the movie.
Seems to work. What do you know!
Thanks for all your help guys.
 
Was that you Calmelman?
If so great! But I'd like to see that function script!

For the benefit of others...
When calling _root (or _level0) from a mc or from a loaded movie, using scene names will NOT WORK!

You either have to add the total frames of all the scenes previous to the one you want to go to or use a labeled frame!
So, if you want to go to frame 6 of scene 3 in the main movie (from wherever!) and that scene 1 holds 50 frames, scene 2 holds 100 frames... you would target frame 156 (50+100+6 = 156) as in:

on (press){
_root.gotoAndPlay(156);
}

A better method is to target a labeled frame, because even if you make changes in scenes (add frames or take some out... etc) the label will allways be attached to the frame you labeled. With the frame number method you would have to re-calculate the final frame number, compensating for the ones you added or took out.

on (press){
_root.gotoAndPlay("label");
}
mywink.gif
ldnewbie
 
Thanks for the help oldnewbie.
I forgot to log in on my last entry so my name never came up.
I am more of a programmer than a flashman so this was right up my alley.

The function was pretty straightforward. You can use it yourself if you like.

function jump_scene(scene_jump) {
if (scene_jump == 1) { gotoandplay("manifesto",1);}
if (scene_jump == 2) { gotoandplay("connection",1);}
if (scene_jump == 3) { gotoandplay("innovation",1);}
if (scene_jump == 4) { gotoandplay("products",1);}
if (scene_jump == 5) { gotoandplay("reality",1);}
}

I accessed it from the movie by say _root.jump_scene(2)
I tried to pass a string to the function but when I typed

gotoandplay(scene_jump,1); it didn't seem to work.

The site is finally up (we are just busy debugging it)
It can be seen on
The stuff that you wrote in your last entry was very interesting. It will certainly help me in future.
Could I not have labelled the first frame of scene 2 and called it by saying

on (press){
_root.gotoAndPlay("mylabel");
}

Thanks
 

Could I not have labelled the first frame of scene 2 and called it by saying

on (press){
_root.gotoAndPlay("mylabel");
}


I thought that was what I was saying!
Would also work as:

on (press){
_root.gotoAndPlay("yourlabel");
}
mywink.gif
ldnewbie
 
What I meant to say was
Can you use the name of a frame in a different scene or does "ourlabel" have to be in the same scene as you are in ?

I think you have already answered this question and unless I am completely clueless the answer was yes.

I have a habit of making flash more complicated than it needs to be
 
Still confused by your last question!
The way I see it, labels have to be unique at least within the same movie and all of it's scenes.
Would having a duplicate label in a other loaded movie called from the above movie, work? Don't really know! would have to check it out! To me, it logically should since you would be targeting another level... But with Flash you never know!
Might be best not to duplicate labels anyways!

Regards,
mywink.gif
ldnewbie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top