Q on buttons and frames and scenes

Ok lets say i have 4 buttons

1 2 3 4

they are all laid out normally now i play my moviewhich displays 1 2 3 4

i want it that when i click on one of them that they play the de-load movie which is on frame 355 of the main movie

on (release) {
	gotoAndPlay(355);
}

what is the code that i put to tell which button was pressed so i can load Scene 1 2 3 or 4?

If I’m understanding you correctly, you’re trying to link to different scenes, if that’s correct then just apply something like this:

on (release) {
    gotoAndPlay("scene2");
}

That would link it to scene 2 obviously. =)

yes… i want to do that but before i go to the next scene i want to play frame up till 355 than go to the next scene

because from frame 355 - 455 i have an animation of stuff dissapearing so how would i do that?

If you want it to go to the next scene when it reaches frame 355, then place this action on that frame:

gotoAndPlay("scene2");

ok… now lets say i have 5 buttons and if i click on one than it goes and play 355 how do i tell each button to goto another scene after its done playing the end of the frame 455

scene1 scene2 scene3 scene4 scene5

apply the first code i posted on the button that is on frame 455

on (release) {
    gotoAndPlay("scene2");
}

another way to do this is through the use of variables. in which you can have the animation of that closing movie in a movie clip on the last frame, and then have a variable determain which button has been clicked.

on the buttons you should tell flash to go to that frame where the movie is. your case frame 355, and also set the variable ‘content’ to a number



//for button 1 (put this on button 1)

on (press) {
    _root.closingmovie.content = 1;
    gotoAndPlay(355);
  }
//for button 2 (put this on button 2)

on (press) {
    _root.closingmovie.content = 2;
    gotoAndPlay(355);

then in the mc in which the closing animation is in (in the above code i gave this mc the instance name “closingmovie” remember to give this movie that instance name.)

put this code in a frame after your animation


if (content == 1) {
    gotoAndPlay("scene2");

if (content == 2) {
    gotoAndPlay("scene3");


and so on

this is not tested, off the top of my head, so give it a go, iam going to check it out when i get home, hope it helps.

i have no idea why, but its not working for me??

:-\ :-\

here is what i had and was trying to do, i think its something to do with the scene issue in mx, though i thought i fixed that problem. have a look anyway. ill keep at it.:crazy:

ok fixed now, before i was using


if (_root.content == 1) {
    _root.gotoAndPlay("Scene 2", "section2");
}


when to make scenes work in flash mx i used, which works now



if (_root.content == 1) {
    _root.gotoAndPlay("section2");
}


all works now, hope this is what u wanted. :slight_smile:

:smirk:

ok it is , but i think you guys mixed up … its not a movie really its just the main frame going from 355 - to 555 or something its not a movie clip! Its just animation of stuff de-loading on the main timeline so how then would i do it ?

you could just cut and paste those frames into the movie clip or you can change some , give me a sec

ok here is the file using the code on the maintimeline ,

ok, now what i changed was the following::

got rid of the _root. tags on the if statments

changed the buttons to go to frame label on the main timeline

copy and pasted the animation of the rectangle on the main timeline. as well as the code (if statements)

::: added some buttons on scene 2-4 to get back to the main scene.

here is the file
Hope this can help you :smirk:

:::::Can i just add and this is no means to tell you off.

i hope you understand whats happening in the fla , because this is for you to learn not just to get the flas and make a website. if you dont understand what i have done, please tell me , and i will explain it… i dont mind helping, i enjoy helping others. just hope your learning from all this.

:smirk:

Oh no way , you are actually helping me im learning little by little i always get confsued with using variables and stuff. But i try to do a lot of looking around on tutorials and how to do stuff… I actually look at your .fla you send and try to compare on what im trying to do , just the .root stuff gets way out of hand for me and i get lost.

ok kool, explain what the problem with the root stuff?

by the way download this fla instead , i forgot to add some graphic, call me picky :wink:

on the new .fla you sent me the closingmc isnt being used right?

and why do you have

gotoAndPlay(15);

at the end?? dont you already do that when u click on the button?

if (content == 1) {
	_root.gotoAndPlay("section2");

this means that its going to search for section 2? in the root folder?

theres no closing mc?

the code go to frame 15 is so that the if statement can loop, so if the if statement in frame 14 is false it would just play, so i put that code in 15 so it can go back until the if statement is true.

if (content == 1) {
_root.gotoAndPlay(“section2”);

this is asking flash if the content = 1, i make the content = 1 in the button, but this is asking it. (if statment)

and the reason i used _root.gotoAndPla(“section2”) is that there is a bug in flash that dosent allow you to directly go to a scene so you have to use a framelabel in the next scene and point to that.

yes if you have section2 in your main timeline, it would go to that, but just name it something original like “startscene2” and it will be ok

::: do u get it?

Yeah i get it. thanks for your help!:pope:

      This coding stuff is giving me a headache but i do get it , just writing it is the worse , whats a good place i can learnt eh variables and commands and stuff like that?

right here on kirupa!! ask , search and look at fla’s, and learn .
experimentation is the best advice i can give you!! :wink:

ok , im busting my brains out… ive already did the code for the deloading of the movie… now lets say

i have another button and if they click on that one it loads something else??? im going insane im using the format u gave me but where do i put the new label and the code?? im going insane$#@()$()#@#@ ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
::hangover: :hangover: :hangover: :hangover: :hangover: :hangover: :hangover:

If i have scene2 and with the same buttons do i put a new label called end2 and then do that??? or what im really confused

do i still use

if (content == 1) {
	_root.gotoAndPlay("pressreviews");
}
if (content == 5) {
	_root.gotoAndPlay("thirsty");
}
if (content == 2) {
	_root.gotoAndPlay("events");
}
if (content == 3) {
	_root.gotoAndPlay("smile");
}
if (content == 6) {
	_root.gotoAndPlay("munchies");
}
if (content == 7) {
	_root.gotoAndPlay("callus");
}

this is not in the main page this is from scene2(thirsty) so does th _root level still apply?

i think you are going the wrong way with this, if what your doing is making a website with scenes i would advice against it, simply use external movies, this way you could keep the menu of the main movie and just bring in section with a seperate external movie.

if this is the case check out this link

http://www.kirupa.com/developer/mx/full_site.htm

and you can implement the code for closing animation into that.

it would be better to post your fla , so i can see what your trying to do. tell me how you go.