PDA

View Full Version : Menu bar disappears, but I know it's there!



gotemgreat
May 3rd, 2005, 09:13 AM
Hiya,

I am loading levels into a main swf, these levels load via a Menu bar built into my main movie... how do I keep the menu bar from disappearing as the other layers load into the main? I know it's underneath my other levels cuz I get a mouseover on the buttons, I just can't see the menu bar...

Any snippet of code to make this work would be awesome!

Peaceout.

MacGuyver
May 3rd, 2005, 09:18 AM
You can make the Menu bar a separate .swf and load it on level 999 or so, then you can load the other files on levels < 999.
You can also use swapDepths(); but that will be a little more complex.

gotemgreat
May 3rd, 2005, 12:36 PM
Thanks for the quick response...

Ok, it makes sense to put the menu bar on a seperate higher level... but then how do I call other external clips to show up on the main time line? I already have my containers in place, but not sure how to reference them in the code on the menu bar. It would be great if you could direct me toward a good tut on the subject, I've been looking around with little success.

Thanks again.

gotemgreat
May 3rd, 2005, 12:57 PM
Ok, I figured out how to call the other external files... that was a piece of cake. However, I am still having the same problem. My menu bar is on level 99 and it is still not visible... hiding behind my other layers after I press a button. How do I make layer 99 permanently visible above all my other layers? Thanks.

MacGuyver
May 3rd, 2005, 03:55 PM
Well, if by 'layer' you mean physically a layer in the Stage Timeline, all you have to do is put your layer with the menu above all other layers (the ones with the containers).
Otherwise, you just load the external movies in a level less than 99.

gotemgreat
May 3rd, 2005, 11:52 PM
Heya,

Ok, I got that part figured out... but how do I write for the code for the button? For example, say the movie clip I want to load on the main is called baby.swf with the instance name baby1... Then for the button would I write:

on (release){
_root.baby1.loadMovie("baby.swf", 2);
}

On my main timeline I have the code for the container like this:

createEmptyMovieClip("baby1_holder", 2);
baby1_holder.loadMovie("baby.swf");

I have a stop on the first frame of the baby1 movie.

Please let me know if I am on the right track here...

Thanks for your time!

MacGuyver
May 4th, 2005, 08:55 AM
on (release){
createEmptyMovieClip("baby1_holder", 2);
baby1_holder.loadMovie("baby.swf");
}
That would do.
You can also put the first line on the timeline and leave the second line in the button, but the code you posted above for the button will not work (there is no instance named "baby1", and you cannot specify a level when using loadMovie(); )

MacGuyver
May 4th, 2005, 10:08 AM
Okay, let's see... First of all you should load your menu on a higher level, so put this on your timeline:

loadMovieNum("menu.swf",999);
Then you want the container (you don't need to, but anyway), on the timeline:

this.createEmptyMovieClip("baby1_holder", 2);
And finally on your button, assuming the before-mentioned timeline was _root, place this code on the button:

on (release) {
_root.baby1_holder.loadMovie("baby.swf");
}

Tell me if it works now =)

gotemgreat
May 4th, 2005, 01:16 PM
Okie,

I gave your code a shot... but I seem to keep getting some awkward loading stuff when the external file loads. If you are lucky you may see a glimpse of the green background as it tries to load... press the green button to test. I have included a sample with what I am trying to do... I have the main.swf, menubar.swf, then two other backgrounds (green.swf and orange.swf) that I am trying to load into the main (or menubar) by pressing the green and orange buttons on the menubar.swf. I have the orange button setup in a different way, but that loads on top too. As you can see, the menubar always seems to stay in the backgound except on the main.swf... hopefully you will see what I'm trying to do by the example. I am quite new to flash (must be obvious) but I'm doing my best to learn as much as I can through tutorials and forums...

I really appreciate the guidance.

MacGuyver
May 4th, 2005, 03:08 PM
Ok, apparently you dislike loadMovieNum(), so let's see... On the file main.swf, fix the following:

this.createEmptyMovieClip("menubar_holder", 999);
menubar_holder.loadMovie("menubar.swf");

You need to provide a source to createEmptyMovieClip();

Then, on file menubar.swf, on the buttons:

on (release) {
_root.greenbg.loadMovie("green.swf");
}

Your movieclip is named "greenbg", not "greenbg_holder"

Now it works.

gotemgreat
May 4th, 2005, 10:01 PM
SWEEEEET, I finally feel like I am getting somewhere... that code worked and it does exactly what I wanted it to.... HOWEVER (surprise, surprise) there is another twist... I initially hade a movie which loads up on the initial load with a preloader I have built in my main.exe, it's called rust.exe...even though it's on level 1 and below by green movie, it seems to always stay on top of any other movies but under the menu bar. I think I need to designate a higher level for green to get this to work correctly. How do I prevent this. Would it help if I unloaded level one at this point? Not really sure how to handle this...

What I really want is for green.swf to be loading in main.exe, not menubar.exe.

Attached is another sample which includes rust.exe and the problem I am having. Would really appreciate if you could take another look.

Thanks Again!

gotemgreat
May 5th, 2005, 08:26 PM
Hellooooo... is there anybody out there that can help me with this? Anybody? This thread looks like it's getting a lot of views, I could really use the help...

Thanks and peaceout!