9 Replies Latest reply on Apr 7, 2009 6:37 PM by kglad

    Loading a menu bar as the movie clip loads

    Level 1

      I have a horizontal menu bar across the bottom of a site I manage, and I would like to load it as the Moive content loads. I have made the menu bar into it's own movie clip, but I cannot work out the code to relate the Menu bar movieclip to the parent movie clip.

       

      The site I am trying to implement this on is at the following URL http://www.aitorthroup.com/Aitor_new_btn.swf

       

      I am using the below code at present - please someone help!

       

      onClipEvent (enterFrame) {
          if (_root._framesloaded < this.frame) {
              stop();
          } else {
              nextFrame();
          }
      }

        • 1. Re: Loading a menu bar as the movie clip loads
          kglad Adobe Community Professional & MVP

          i'm not sure what you're trying to do, but to refernce the parent timeline from the child, you can use this._parent.

           

          you almost certainly shouldn't be using an onEnterFrame loop and you certainly shouldn't be using one that's attached to an object and therefore cannot be deleted.

          • 2. Re: Loading a menu bar as the movie clip loads
            Level 1

            Hi Kglad,

             

            I am trying to make the buttons of the nav menu appear when the associated frame loads, as at present on http://www.aitorthroup.com

            all the buttons appear even if the content of the frame they relate to isn't loaded.

             

            I have setup the buttons along the bottom as a seperate movie clip, which reveals a new button on each frame, what I would lke to do is control this progress of this movie clip by associating it to how many frames have loaded in the main movie.

             

            Can you suggest what code would be suitable to use please?

             

            Thanks,

             

            R

            • 3. Re: Loading a menu bar as the movie clip loads
              kglad Adobe Community Professional & MVP

              it doesn't make sense to display only the navigation button associated with the current page.  how will users navigate to a different page?

              • 4. Re: Loading a menu bar as the movie clip loads
                Level 1

                No!

                 

                I want to display any button that the associated frame has loaded eg. If frame 2 has loaded it will only display the button that relates to frame 2 until frame 3 loads, and then the button related to frame 3 will display and so on, until all the frmaes have loaded, and it will show all buttons.

                 

                The reason I want to do this, is at present the site displays all buttons, but you cannot view the content until the frame/image has loaded, I want to be able to prevent users clicking the button, prior to the content loading, but I do not want to have to have a loading screen.

                • 5. Re: Loading a menu bar as the movie clip loads
                  kglad Adobe Community Professional & MVP

                  what's the relationship between your button instance names and the main timeline frame numbers?

                  • 6. Re: Loading a menu bar as the movie clip loads
                    Level 1

                    The buttons have the same name as the frmaes in main timeline. They also sit in the same order as the frames in the main timeline, and can be in the same frame number if necessary.

                    • 7. Re: Loading a menu bar as the movie clip loadsa
                      kglad Adobe Community Professional & MVP

                      as2 has no way to associate frame labels with frame numbers and you can't determine load-progress based on frame label.

                       

                      so, you'll need to create some way to determine your loaded frame labels given the loaded frame number.  you can then use array notation to convert that frame label to the corresponding button.

                       

                      that way, you can assign all your buttons' _visible properties to false and as frames load, change the appropriate buttons' _visible properties to true.

                      • 8. Re: Loading a menu bar as the movie clip loadsa
                        Level 1

                        I think I am almost there with below code! But for some reason it displays the buttons if the frmaes have loaded or not - what am i doing wrong?

                         

                        while (_root._framesloaded < _root._framesTotal){
                            if (_root._framesloaded < 2){
                                _root.stickemup_btn._visible = false;
                                } else {
                                    _root.stickemup_btn._visible = true;
                                    }
                                    if (_root._framesloaded < 3){
                                        _root.rsasaddle_btn._visible = false;
                                        } else {
                                            _root.rsasaddle_btn._visible = true;
                                            }
                                            if (_root._framesloaded < 4){
                                                _root.rsalineup_btn._visible = false;
                                                } else {
                                                    _root.rsalineup_btn._visible = true;
                                                }
                        }

                        • 9. Re: Loading a menu bar as the movie clip loadsa
                          kglad Adobe Community Professional & MVP

                          while-loops and for-loops are not suitable for this.  they loop from beginning to end while no other code executes and nothing else occurs (including asset loading).

                           

                          you should use an onEnterFrame or setInterval() loop.