5 Replies Latest reply on Jul 27, 2006 6:56 AM by Nickels55

    Flash buttons!

    danturn100 Level 1
      i have a logo of a lightning bolt which i want want to change colour when rolled over but play a small animation of flashing when clicked on beofre loading a seperate HTML page.

      i made the rollover image and put that on the "over" keyframe
      i made the flashing animation as a seperate flash movice and have put that on the "down" keyframe

      now, when i rollover the image changes colour fine and when i click and hold it plays the animation, but if i just click it reverts to the "over state"

      is there any way of getting it to ignore the "over" state once the "down" state is activated?

      im new to flash, i could do this in about 3 seconds in Director! (RIP)

      x
        • 1. Re: Flash buttons!
          behived_new Level 1
          maybe you can start to use a movieclip as a button.
          give the mc an instance name.
          Instead of putting the actions on the button, you can put all actions in a frame like this:

          button1.onPress=function(){
          //here you put your actions
          }
          button1.onRollover=function(){
          //here you can put some other actions
          }

          advantages: all your code is on 1 place, you never have to search for some code again.
          you can put more control on your buttons, but it demands a little more scripting.
          • 2. Re: Flash buttons!
            danturn100 Level 1
            thats great, id rather use more action script! i just couldnt work out how to put action script on a button as it says you cant on the up/down/over/hit frames!

            ill try it out now

            dan
            • 3. Re: Flash buttons!
              danturn100 Level 1
              ok, i have the code:

              LOGO.onPress=function(){
              nextFrame();
              }

              on frame 1 but... it doesnt stop and wait for user input, i tried putting stop(); at the beginning and the end and that doesnt seem to help

              i have 2 frames 1 normal and 1 for the rollover, so when the file opens i want the playhead to stop in the first frame until the mouse button is clicked then when its clicked i want it to move to the second frame and pause there (i have a stop(); thing on the 2nd frame already!)

              sorry for being such a n00b, flash really isnt my thing. i for some silly reason learnt director instead!

              dan
              • 4. Re: Flash buttons!
                danturn100 Level 1
                sorry, i solved my own problem, i hadnt named the instance of the logo "LOGO"
                :(
                • 5. Re: Flash buttons!
                  Nickels55 Level 2
                  The above code is not to be placed on a button. That is code to be placed on a frame on the timeline. Then you give the button an instance name of "button1".

                  Here is the difference...

                  Code attached to a button:
                  on(Release){
                  //function here
                  }

                  Code attached to a frame:
                  button1.onRelease = function(){
                  //function here
                  }

                  You don't need to do anything to the buttons over/hit/up....state.
                  What you do is make a movieclip with all of your animations and you have that sit under an invisible button. You then make the invisible button control the movieclip below it.

                  Hope that makes sense.