4 Replies Latest reply on Apr 28, 2006 5:02 PM by brendafos

    button click/release action

      I'm learning flash and since I have a Java programming background it's going great. Flash8/Actionscript2 is an amazing tool.

      My questions is about button actions. I've suceeded with "buttons" built as Movie Clips. But for "buttons" build as Buttons I'm unsure of where the action goes. I can build the button with Up|Over|Down|Hit states but where do I put the click or onRelease action? Say you have a button that when clicked should take you to an "outside" URL.

      I have been making a layer called "actions" and then put, where possible, all the actionscript together in the first frame. I've tried writing- name_of_btn.onRelease = function() {} -- like I have for movie clip buttons but it does not seem to work for buttons.
      There must be an easy answer to this. Am I putting the script in the wrong place, or using the wrong call? This is dumb, I've done this whole website in Flash and the buttons that I've written as Movie Clips work, but the buttons that are Buttons I've not been able to make "work".
        • 1. button click/release action
          put the AS on the button :
          * select the button and press F9

          on (press) {
          getURL ("address.htm", "_blank");
          on (release) {
          getURL ("another_address.htm", "_blank");

          • 2. Re: button click/release action
            Still not working.

            When you say put the AS in the button, do you mean when timeline is the four states in the UP state press f9 and put it there? Can's I put it somewhere else by using the path to the button? I'm trying to write actionscript all in one frame for most items.

            And I tried---
            on (press) {
            _root.theLoader.contentPath = ("about.swf");

            but this does not work. I'm trying to load another .swf file using the Loader object.

            I'd rather use a full path in the call like --

            my_button_btn.onRelease = function () {
            _root.theLoader.contentPath = ..........
            • 3. button click/release action
              When assigning an action to a button:

              1. Create the Symbol, select button ... create your 4 button states and then go back to the Scene ...
              2. Have the button selected on the stage (Not the frame)
              3. Open the Actions Panel
              4. In the Timeline Control, assign one of the actions, such as getURL(" http://www.whatever.com/index.htm", "_blank");...or assign another mouse event code to trigger another action.

              Hope that helps,

              • 4. Re: button click/release action
                brendafos Level 1
                Still not working.

                I want to call my movieClipLoader. Can I do this?
                on (press){

                I tried this using _root. added too, but no luck.

                What is special about _btn ?