Scenes

This is just a tad difficult to explain but here goes. You start out in the intro scene and it plays a movieclip (the intro) and below it is another clip that is a loading bar and percentage. Now on the main timeline it is checking to see if the percentage is 100 or greater. When it does it goes to the main movie. This all works fine. It’s when you get to the main movie that it messes up. All the buttons and a/s work fine but 3. Its sorta hard to explain… Um ok here is the a/s that is on each button unless they dont open another menu.\r\ron (release) {\r _root.per = “1”;\r}\ron (release) {\r gotoAndPlay (2);\r}\ron (release) {\r _root.here = “Diablo 2”;\r}\ron (press, rollOver, dragOver) {\r _root.there = “Diablo 2”;\r}\ron (releaseOutside, rollOut, dragOut) {\r _root.there = “”;\r}\ron (rollOver) {\r tellTarget ("_root.spin.arcpoint") {\r rot = “59”;\r flag = “1”;\r }\r}\r\r"here" and “there” are just navigation. “per” is the variable used to know what menu to open next. “rot” and “flag” are for the rotation of the m/c in the middle. All of this is an example from one of the bad buttons. The next a/s is the second frame of the main timeline.\r\rif (_root.movie1._currentframe>1) {\r tellTarget ("_root.movie1") {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie2._currentframe>1) {\r tellTarget ("_root.movie2") {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie3._currentframe>1) {\r tellTarget ("_root.movie3") {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie4._currentframe>1) {\r tellTarget ("_root.movie4") {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie5._currentframe>1) {\r tellTarget ("_root.movie5") {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie6._currentframe>1) {\r tellTarget ("_root.movie6") {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else {\r tellTarget ("_root.movie"+per) {\r gotoAndPlay (2);\r tellTarget ("_root.sound1") {\r gotoAndPlay (2);\r }\r }\r gotoAndStop (1);\r}\r\rNow I probably could use a for statement for the first bunch but that’s not the point of this explanation now is it. :wink: Normally the movie is in frame 1 but when you click a button that opens a new menu it goes to frame 2 and makes sure all menus already open get closed. Hence the reversal of any open m/c’s. Then if none are open it opens the new menu using the “per” value from the button. Now for the problem. When I click any one of the 3 buttons it sends the whole m/c back to the intro scene. Why? Any how do I fix it? If you need anymore info I’ll be glad to post it.\r\rEdit: May help or not. It only messes up like this when I place the intro first. If the order of the 2 are reversed there is no problem at all.

I printed this out… I’ll take a look.

omg I left flash for a day or 2 and forgot all about this prob. If you want I can show you the swf. It does one of those slowing your computer errors though. I dunno why, it’s just telling the scene to change… maybe I should jsut send you the fla

no problem. to tell the truth I forgot to look at it. Very sorry for that. I’m looking at it now.

I did get your FLA file but it seems not to have transfered correctly. I’m missing movie clips and all sorts of stuff. I’ll try to fix it by explaining a little a/s correction here.\r\rok first the buttons\r\r

\ron (release) {\r_root.per = “1”;\r}
I’m assuming at this point that the 1 here is supposed to be a number. With quotes around it it’s considered a string. If you need these to be a number, change the check box in the action panel to “expression” if you’re working in basic mode.\r
\ron (release) {\rgotoAndPlay (2);\r}
\rSomething to note about gotoAndPlay commands. using frame numbers, like 2 in this case, the movie does something funny. After the movie is published in swf format, it merges all layers and all scenes into one long scene with one layer. As such, the frame number 2 refers to the second frame in the movie without scene knowlege… smack dab in the middle of your preloader in scene 1. When using a gotoAndPlay, to another scene, use frame labels. it would look like\ron(release){\r gotoAndPlay(“scene1Opener”);\r}\rthen you create a new layer. Label it “frameLabels”, go to the frame you want this goto statement to send the play head to; open you frame panel, and enter a name in the field provided. You’ll see a little red flag apear on that frame, and it’s label will follow unless cut off by another keyframe.\r
on (release) {\r_root.here = “Diablo 2”;\r}\ron (press, rollOver, dragOver) {\r_root.there = “Diablo 2”;\r}\ron (releaseOutside, rollOut, dragOut) {\r_root.there = “”;\r}\ron (rollOver) {\rtellTarget (“_root.spin.arcpoint”) {\rrot = “59”;\rflag = “1”;\r}\r}
\rSee my note above about this 59 and 1. If they are currently strings variables.\rThe last thing to note about this is that you cannot have multiple calls to the same function. All of your on(rollOver) events must be under a single on(rollOver){} code.\r\rIf I’m correct on all these things then it would look a little more like this:\r\ron (release) {\r _root.per=1;\r _root.gotoAndPlay (“start”);//start being the name of the frame\r _root.here=“Diablo 2”;\r}\ron (press, dragOver) {\r_root.there = “Diablo 2”;\r}\ron (releaseOutside, rollOut, dragOut) {\r _root.there = “”;\r}\ron (rollOver) {\r _root.there=“Diablo 2”;\r _root.spin.arcpoint.rot=59;\r _root.spin.arcpoint.flag=1;\r}\r\rNow the frame 2 code… this is an evil tapestry you’ve woven here. I’m completely confused by it. I’ll try to work out what I can though.\rThe first thing I thought of was, you’ve not counted your {} correctly. I’m not sure if this is true… I’m still sorting through them but if I were you I’d check them very carefuly. Switch to basic mode if you need to. If there is an error in the structure of the {} marks the program will tell you when you switch.\r
\rif (_root.movie1._currentframe>1) {\r tellTarget (“_root.movie1”) {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r}else if (_root.movie2._currentframe>1) {\r tellTarget (“_root.movie2”) {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie3._currentframe>1) {\r tellTarget (“_root.movie3”) {\r gotoAndStop (_currentframe-1);\r }\r
this wont work. I know you want to reverse the frames but it simply cannot be done this way. Increasing K will decrease the processor problem. That is to say, double the movie clip by adding the same animation twice. Once forwards and once backwards. I think that every Flasher has tried to run frames backwards, and all that I’ve known of have failed at the task. :slight_smile: If you hear of a good method of doing this, let me know. I’m genuinly interested.
\r gotoAndPlay (2);\r} else if (_root.movie4._currentframe>1) {\r tellTarget (“_root.movie4”) {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie5._currentframe>1) {\r tellTarget (“_root.movie5”) {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else if (_root.movie6._currentframe>1) {\r tellTarget (“_root.movie6”) {\r gotoAndStop (_currentframe-1);\r }\r gotoAndPlay (2);\r} else {\r tellTarget (“_root.movie”+per) {\r gotoAndPlay (2);\r tellTarget (“_root.sound1”) {\r gotoAndPlay (2);\r }\r }\r gotoAndStop (1);\r }
\rlike I said… I’d count out the {} brackets and make sure that they all have an opening and a closing.\r\rin the case of this last tell target. With the new notation you can write most tellTargets simply like this.\r_root.myMovieClip.gotoAndPlay(someFrame);\r\rThat means that you can change all those tellTargets to the new method and shrink your code quite a bit. The other thing is that you can set variables using the same method. If our move clip had a variable called “flag” in it, all you’d have to do to set it would be any one of the following.\r_root.myMovieClip.flag=true;\r_root.myMovieClip.flag=42;\ror\r_root.myMovieClip.flag=“some string in here.”\r\rIn the case of the last tellTarget you are using a varying movie clips depending upon a variable. This can still be done with the new method… it just takes a trick.\r_root[“myMovieClip”+variable].flag=true;\ryou can’t put quotes in a dot syntax call like this, unless you put square brackets around the quote and the variable that’s being added to it. You’ll notice that the dot after _root is not there. That’s on purpose. You leave out the dot before the brackets, and leave IN the dot after the brackets. It’s a pain in the butt to remember, I know… just memorize the method and you’ll have a much easier time scripting in the future. I have many posts in the “best of Kirupa” section which detail the change over from tellTarget’s to this “new” method.\r\rcoincidentaly, in case you’re having misgivings about learning the new method, this is the same method that javascript uses, as well as extreme programing languages like C++. If you learn it now, in flash, it will help you with any of the other object oriented programs…

\r ok first the buttons\r\ron (release) {\r_root.per = “1”;\r}\r\rI’m assuming at this point that the 1 here is supposed to be a number. With quotes around it it’s considered a string. If you need these to be a number, change the check box in the action panel to “expression” if you’re working in basic mode.\r\ron (release) {\rgotoAndPlay (2);\r}\r\rSomething to note about gotoAndPlay commands. using frame numbers, like 2 in this case, the movie does something funny. After the movie is published in swf format, it merges all layers and all scenes into one long scene with one layer. As such, the frame number 2 refers to the second frame in the movie without scene knowlege… smack dab in the middle of your preloader in scene 1. When using a gotoAndPlay, to another scene, use frame labels. it would look like\ron(release){\rgotoAndPlay(“scene1Opener” ;\r}\rthen you create a new layer. Label it “frameLabels”, go to the frame you want this goto statement to send the play head to; open you frame panel, and enter a name in the field provided. You’ll see a little red flag apear on that frame, and it’s label will follow unless cut off by another keyframe.\r
\r\rOk I see what you’re saying here and it seems to make sense regarding what the movie looks like when I play it in I.E.\r\r\r
\r on (release) {\r_root.per=1;\r_root.gotoAndPlay (“start” ;//start being the name of the frame\r_root.here=“Diablo 2”;\r}\ron (press, dragOver) {\r_root.there = “Diablo 2”;\r}\ron (releaseOutside, rollOut, dragOut) {\r_root.there = “”;\r}\ron (rollOver) {\r_root.there=“Diablo 2”;\r_root.spin.arcpoint.rot=59;\r_root.spin.arcpoint.flag=1;\r}\r
\r\r\rI dunno if that makes any difference at all from what I have. I have several rollOvers, etc and it still works fine.\r\r\r
\r if (_root.movie1._currentframe>1) {\rtellTarget (“_root.movie1” {\rgotoAndStop (_currentframe-1);\r}\rgotoAndPlay (2);\r}else if (_root.movie2._currentframe>1) {\rtellTarget (“_root.movie2” {\rgotoAndStop (_currentframe-1);\r}\rgotoAndPlay (2);\r} else if (_root.movie3._currentframe>1) {\rtellTarget (“_root.movie3” {\rgotoAndStop (_currentframe-1);\r}\r
\r\r\rThis script is activated when you click on one of the buttons on any menu in the “menu circle”. It goes down the script checking to see if any menus are open and if they are moving them back a frame. It continues to do this until they are all at frame 1 and then opens “movie”+per which was set when you clicked the button originally. And the reversal of the m/c’s do work. Note: lol I created an evil tapestry. :)\r\rNow other than the first piece of advice you gave me about the frame names instead of numbers I don’t know why I would have to change it because it all works…\r\rI’ll stick the swf up on a site for ya to look at. www.angelfire.com/ca6/FP

Ah the whole time it was those stupid frame numbers. I switched them to frame labels and it works perfectly. Thx for pointing that out. Although I do have the reversal of the movies working perfectly fine and the rollOver, Release, etc. doesn’t seem to make a difference at all whether they are grouped or separate. I must admit though that your way of writing it is still more organized. :wink:

Well, I’m surprised that those other things work, but not that surprised. I’m just taking guesses here based upon past information… but certainly some of that can be false. I’ll have to look into the reverse frames option that you have going on…\r\rGlad the frame labels thing is working. :slight_smile:

About the reverse frames thing, I don’t think it will work if it’s gotoAndPlay but will if it’s gotoAndStop. In frame 2 it has the script that reverses the movie but when it goes to frame 3, if it was gotoAndPlay, it would cancel the effect of the reversal by moving forward 1 frame which I think is what you were talking about. But by stopping it it waits till you get back to frame 2 and then plays it back 1 frame again. Figured that out from some script I got on Flashkit i think. Had to rewrite the whole thing to get it to work in mine but hey, it’s good practice.

Can you do me a flavor?\r\rZip the FLA file and then send it to me again. Zipped FLA’s tend to transfer a bit better.\r\rMostly I’d just like to see exactly what the play head is doing in that case. I had the feeling that you might be going around the backwards movement by the solution of gotoAndStop… but I’d really like to see it in action. :slight_smile: \r\rYou don’t have to of course… but if it’s cool my Email is [email protected]

I didn’t know I sent it to ya the first time… but I’ll zip it up and send it your way.\r\rEdit: Ok winzip is pissing me off so I’ll just send you the FLA instead. :wink:

Well you either sent it out, or I got in from a web page. When I did though it was missing all sorts of elements from the movie.

Did you get the one I emailed? Or did you head to www.angelfire.com/ca6/FP ? Both of those are incomplete. If when you say missing elements you mean you click buttons in the movie and they don’t open anything then you’re right. They are missing because they are separate swf’s. If those aren’t the missing elements then can you give me an example of one so I know what you are talking about? I’ll run my site for a bit so you can see what it should look like. [url=“http://scribble.ath.cx”]scribble.ath.cx This heads to the complete movie with all the links that I’ve finished up and working. StarCraft and Tribes 2 don’t have anything in them by the way.\r\rEdit: Oh wait a sec are you talking about the one you say I sent to you earlier? When I was thinking of sending it to you. (about 4 or 5 post up) What did it look like cuz I never sent one out until you requested one 2 posts up.