7 Replies Latest reply on Feb 4, 2007 10:17 AM by kglad

    Menu to Fade In/Out New Background Images and Text

    Kesey16
      I'm trying to create a navigation menu to fade background images in and out based upon what the user clicks.

      So, for example, I have:

      Contact
      About
      Portfolio

      The stage when the user clicks contact has one background, and then when they click about, I want that background to fade out while the background fades in. My problem is, you don't know which order the ppt will choose to navigate the site so you can't hardcode the background that needs to fade out.

      Can anyone point me to some code for this? Or a tutorial which may be helpful?

      Thanks in advance.
        • 1. Re: Menu to Fade In/Out New Background Images and Text
          kglad Adobe Community Professional & MVP
          1. your backgrounds should all be movieclips.
          2. you should assign a linkage id to each background movieclip
          3. when a link is clicked use a variable to store the name of the (next) background movieclip that will be faded-in (when the previous is faded-out).
          4. start a loop that fades the current background when a button is clicked. again use a variable to store a reference to the current background movieclip.
          3.5 this usually comes after the above step but pertains to something you should do before the above: clear the above loop before starting it.
          5. when the above fade completes, assign the variable that contains the current background movieclip to the next background movieclip and start the fade-in of the next background movieclip.
          6. terminate your loop when fade-in is complete.
          • 2. Re: Menu to Fade In/Out New Background Images and Text
            pubchum
            you need to learn how to use the LoadMovieClip Class. I am into loading and fading external pics too and Had too much trouble trying to coordinate everything with onEnterFrame / delete onEnterFrame / gotoAnd....

            when working with objects (a hurdle in itself) you will find this stuff much easier to handle. I can't remember the good tutorials, but there's a few out there on google.
            • 3. Re: Menu to Fade In/Out New Background Images and Text
              kglad Adobe Community Professional & MVP
              pubchum, what makes you think he's loading anything?
              • 4. Re: Menu to Fade In/Out New Background Images and Text
                Kesey16 Level 1
                Thanks for pointing me in the right direction. I ended up ditching the fade out, and just went with fading the backgrounds in. I used a single movieclip's timeline to house each background fading in and then used action script to code the buttons like so:

                btnAbout.onRelease=function(){
                currBackground="about";
                _root.mcBackground.gotoAndPlay("aboutIn");
                }

                Now I have to figure out if I can use my variable currBackground with other pieces of the animation. This way, I'll be able to change the color of the about button for example to let the user know that they're on the about page.

                Any thoughts? I'm not sure this was the best way to code it, but it sure seemed like the easiest. I wasn't too sure how to go about using the loop.
                • 5. Re: Menu to Fade In/Out New Background Images and Text
                  kglad Adobe Community Professional & MVP
                  if you want to code all the color changes in one location you can use the watch() function to detect changes to currBackground and color the old value the default (not viewed page) and color the new value the whatever to indicate the viewed page.

                  or just add the code to each button.
                  • 6. Re: Menu to Fade In/Out New Background Images and Text
                    Kesey16 Level 1
                    Thanks.

                    So, if I use a variable within one movie clip container, is it accessible within other movie clips or the main fla timeline? Do I have to declare the variable as global somehow?
                    • 7. Re: Menu to Fade In/Out New Background Images and Text
                      kglad Adobe Community Professional & MVP
                      the variable, as used above with no prefix, will be available within all the other onRelase handlers that are defined on the same timeline.

                      if you prefix with _global, the variable will be available on all timelines in the same _level.

                      if you prefix with var, the variable will only be defined locally in that onRelease handler. (which would be of no use to you in this situation.)