6 Replies Latest reply on Dec 3, 2009 12:36 PM by Ned Murphy

    Making buttons work

    budge_frownie

      Hi guys

       

      Another problem I ran into recently is making a menu for a number of pages.

      It starts with an image tweening to the top and then reaches a frame with a container movieclip

      Inside this container lie my buttons, my question is where would I place my action code in order to make the buttons link off to a url, would it be inside the container or on the original timeline

       

      I've tried putting the following action on a button

      on (release) {

      getURL ("name");

      }

       

      that did not work so I created a seperate action layer and gave my button an instance name like key_btn and then tried this

      key_btn.onRelease = function ()

      {

      getURL("name");

      }

       

      None of these methods seem to be making my button actually get my url, is this because the buttons are within a movie clip and something else needs to be added to the code when this happens

       

      Thanks for looking and helping if you can!

        • 1. Re: Making buttons work
          Ned Murphy Adobe Community Professional & MVP

          If you atached that code directly to the button it should have worked, assuming you had an actual url address in the function argument.  If the second attempts code as in the same timeline as that holding the button, that should have worked as well.

           

          Does the movieclip containing the buttons have an mouse-related code assigned to it?  If so, that would be blocking the buttons from mouse interaction.  There is a possibility that transitioning into things might be a source of the problem, though if the buttons themselves do not animate into place within the movieclip, that should not be the case.

          • 2. Re: Making buttons work
            budge_frownie Level 1

            Hi Ned, yes the url was placed in the "name" area. The button was working fine on the main time line but when I made buttons inside a container they just dont seem to work. I currently have a 2nd state to the button but tried turning this off still no luck. Do i need to target the main time line in order to get urls from inside a container?

             

            Oh I should also mention the button is just text for "Key" and starts off as a movie clip fading in, once that fade in tween is completed the next frame on the same layer is a button instance. Does having multiple instances on one layer cause any disruption? I only did this because I wanted my button to have a roll over glow and was not sure how to do this through the movie clip after the tween fade in was completed.

            • 3. Re: Making buttons work
              Ned Murphy Adobe Community Professional & MVP

              Yeah, messing with transitioning into buttons can cause problems.  You are best to get it on its own layer, and if it is involved in the animation process, be sure to give it an instance name at each keyframe.  And if it is somewhere down a timeline, then you need to hold off assigning code to it until you reach the frame where it is.  As far as a container versus getURL... should not matter... you can call up a new web page from any level.

              • 4. Re: Making buttons work
                budge_frownie Level 1

                thanks for that Ned, I'm not sure why but for some reason after publishing the movie and viewiting in safari all the buttons did seem to work but they just didnt function in preview mode. Would it be possible to make a rollover action on a movie clip button as I do not want to complicate things by adding a button after the text animates in

                 

                Thanks

                • 5. Re: Making buttons work
                  Ned Murphy Adobe Community Professional & MVP

                  Yes, you can apply rollovers to movieclips, just be sure to use the instance name approach to cod them instead of the on(...) approach...

                   

                  mc.onRollOver = function()

                  {

                       // do stuff

                  }

                  • 6. Re: Making buttons work
                    budge_frownie Level 1

                    ah sorry this is off topic but if i would want it to glow but choose the settings like only 40% opacity/strength like through the filter option what would my code entail and would i need a rollout function as well to take it back to its original state

                     

                     

                    contact_mc.onRollOver = function ()

                    {

                    ?

                    }