6 Replies Latest reply on Feb 21, 2009 8:38 AM by Ned Murphy

    Connect Buttons to URL

    Night_Watch
      ok so I have a button with the instance name of homeButton. This is the current code that I have set for it.

      homeButton.onRelease = function()
      {

      var URLToGo:String = this._parent.URL_txt.text;
      getURL(" http://www.citroen.co.uk//");

      }

      But the button doesn't work. Please help.
        • 1. Re: Connect Buttons to URL
          Ned Murphy Adobe Community Professional & MVP
          What is that first line of code in the function supposed to be doing?
          • 2. Connect Buttons to URL
            Ned Murphy Adobe Community Professional & MVP
            Before I head off for the night, I figured I'd not leave this hanging. I asked because that line may be the line that's fudging things up and causing the function to fail... it may be trying to work with things that don't exist where you tell it they do. Also, as is, it has no purpose in life.
            • 3. Re: Connect Buttons to URL
              Night_Watch Level 1
              ok. So what would you recommend? I am new to this actionscript stuff.
              • 4. Connect Buttons to URL
                Ned Murphy Adobe Community Professional & MVP
                Try commenting out that line of code so that it's out of the picture (put double slashes '//' in front of it). There are two ways of making comments out of things in Flash, similar to other coding languages...

                // This will be a comment line

                /*
                This will be a comment section, anything between the /*... */ (<--except in reality, that third one next door just closed it)
                */

                I don't see any problem with the button code outside of that line possibly being in the way.

                If commenting out that line doesn't work, since you're new to this actionscript stuff, my next suggestion would be to make sure you have given that button the instance name you say it has. The instance name is not what it is named in the library. You assign the instance name in the properties panel.

                If that doesn't pan out, and you did indeed assign the instance name, then my next question is... What version of Flash are you using, and what version of Actionscript do you have it setup to use (Check your Publish Settings)... it should be AS 2.0.
                • 5. Re: Connect Buttons to URL
                  Night_Watch Level 1
                  Still doesn't work. I copied the instance name directly from the properties panel to make sure it was 100% correct. I am using Action Script 2.0 and I am using Adobe Flash CS4
                  • 6. Re: Connect Buttons to URL
                    Ned Murphy Adobe Community Professional & MVP
                    I know you are using AS2, but is your file setup to Publish using AS2? Check your Publish Settings. Don't get rattled with me repeating this... it often turns out to be worth asking two or three times.

                    If that remains as your answer, then the next wondering is... does clicking the button do anything at all?

                    I have copied your code (commented out that line) and it works fine for me, so there is a chance that your file has become corrupted somewhere along the line. Try this... open a new AS2 file, copy the button instance to it, copy the code to it, and test it.