10 Replies Latest reply on Dec 9, 2008 9:27 AM by TheFlashBadger

    Adding Links to my Flash Buttons, CS3 Professional

    TheFlashBadger Level 1
      Hi

      i have made some buttons that flash when the user hovers over them and need to add links to them as they are the navigation buttons.

      i have got 1 of the buttons to work by using the following code in the actions panel:

      HomeButton.onRelease=function(){
      getURL(" http://www.grangestudridingschool.co.uk/index.html","_self")
      }

      this one works fine and can be seen at www.grangestudridingschool.co.uk

      Another one of the buttons works but will not load up the page, the code for that button is as follows:

      LiveryButton.onRelease=function(){
      getURL(" http://www.grangestudridingschool.co.uk/livery.html","_self")
      }

      The problem I am having with the second button is that it is trying to link to the Livery page but without the .html so it is returning a 404 error because that isn't the title of the page!

      So my first question is: why will it not link to livery.html and/or how do I make it link to that page?

      My second question is why wont my other buttons work as i have used the same code and changed what needs changing, the following are the 2 errors i recive on my other buttons:

      1120: Access of undefined property BreakingButton.BreakingButton.onRelease=function(){
      1180: Call to a possibly undefined method getURL.getURL("www.grangestudridingschool.co.uk/breakingschooling.html","_self")

      Sorry for the long winded explanation but I have been trying with this now for three days and i'm losing quite alot of hair trying to sort it.

      Any help/advise would be greatly appreciated.

      many thanks in advance
        • 1. Adding Links to my Flash Buttons, CS3 Professional
          Ned Murphy Adobe Community Professional & MVP
          As long as the links are valid links, meaning the file exists where you say it does, by the filename you provide, your code should work... It's hard to tell what you meant in saying "without the .html"

          If your code somehow has things doubled up as the error messages seem to indicate, that won't work.

          Look for tiny little discrepancies, like extra dots, or missing quotes, or things of that nature.
          • 2. Re: Adding Links to my Flash Buttons, CS3 Professional
            robdillon Most Valuable Participant
            There is nothing apparently wrong with those two button functions. However, you shouldn't need to use a fully qualified path, you should be able to use a relative path. Further, if you are replacing the current page with a new page, you don't need to use a target parameter.

            The two errors that you show toward the bottom show that you have duplicate words: BreakingButton.BreakingButton and getURL.getURL. You'll need to fix those.
            • 3. Re: Adding Links to my Flash Buttons, CS3 Professional
              TheFlashBadger Level 1
              Thnaks for the reply Nedwebs,

              without the .html, I mean that my pages are all .html, so for the link i need to put .html, but, when the button is clicked, in the address bar it comes up with www.grangestudridingschool.co.uk/livery as apposed to /livery.html, so it isn't linking to my page but trying to just link to /livery.

              With regard to extra dots, missing quotes etc. i copied the code from my home button and pasted into the next button and then changed the button name and the link, so if the home button works should the other buttons not work by using the same code??
              • 4. Re: Adding Links to my Flash Buttons, CS3 Professional
                TheFlashBadger Level 1
                Hi Rob

                Thanks for the reply

                I am still new Flash so please bare with me, what is "qualified path" and "relative path"? Also I didn't want the links to open up in a new window as they are the Nav buttons for the site, when clicking the livery button it didn't open in a new window, just gave me the 404 error and then i could click the back button!

                With regard to the duplicated words, do you mean in the code or in the error message? i have taken a screen shot of the errors so you can see what Flash says!! There is a gap between the words, the first part is the description and the second part is the source code.

                I have uploaded the link to www.grangestudridingschool.co.uk the link is at the bottom left!
                • 5. Re: Adding Links to my Flash Buttons, CS3 Professional
                  Ned Murphy Adobe Community Professional & MVP
                  Your approach to making the other buttons work properly is legit... it's what I'd do. At this point I'd be as baffled as you if it's all as you say.

                  Post the code for all of your buttons as it is now and we'll see if it looks okay anyways.
                  • 6. Re: Adding Links to my Flash Buttons, CS3 Professional
                    TheFlashBadger Level 1
                    Hi Ned,

                    Thats what I thought with regard to making the other buttons work correctly, I have sorted the errors out, when i exported the buttons to use in the site I exported them in AS 3.0, i have changed this to AS 2.0 and the buttons work fine when testing now, well apart from actually linking to anything!!! Which deeats the object!!!

                    I have uploaded all my .fla and .swf files to www.grangestudridingschool.co.uk, the link is at the bottom left.

                    Kind regards
                    • 7. Re: Adding Links to my Flash Buttons, CS3 Professional
                      TheFlashBadger Level 1
                      Iv just noticed, if I double click the flash doc in dreamweaver I got some parameter options to add parameters, can I use the getURL, or other code in here to create the link?
                      • 8. Adding Links to my Flash Buttons, CS3 Professional
                        Ned Murphy Adobe Community Professional & MVP
                        I just looked at one of the files (Breaking Button) and may have found the problem... The button instance is not named (in the Properties panel).

                        And setting them to AS2 was a good catch on your part... AS2 code (getURL) won't fly in an AS3 file (which uses navigateToURL). I assumed these were all in the same file, so if one worked, they all should have.
                        • 9. Re: Adding Links to my Flash Buttons, CS3 Professional
                          robdillon Most Valuable Participant
                          I just looked at your .fla files. The largest single problem is that you have not named the instances of the objects on the stage. You need to give instance names to the buttons.

                          For your home button, you have this code:
                          on (release) {
                          //Goto Webpage Behavior
                          getURL(" http://www.grangestudridingschool.co.uk","_self");
                          //End Behavior
                          }
                          This will actually work without an instance name because you have attached the actionscript directly to the home button. You could also use this:
                          on (release) {
                          getURL("index.html");
                          }
                          That's a relative path. Using the whole path is a fully qualified URL. If all of your files are in the same folder on the server, then you don't need to do that, a relative path is just fine.

                          In the other button .flas, for instance lessons-button.fla, the code says:
                          LessonsButton.onRelease=function(){
                          getURL(" http://www.grangestudridingschool.co.uk/lessons.html","_self")
                          }
                          For this code to work, there has to be something on the stage with an instance name of LessonsButton. You have a button, but you haven't given it an instance name. Select the button on the stage, open the Properties window and type in a name in the space that says <instance name>. Then your code will work.

                          You need to do something similar for each button.
                          • 10. Re: Adding Links to my Flash Buttons, CS3 Professional
                            TheFlashBadger Level 1
                            Many thanks for your assistance Rob & Ned

                            I added the instance and they all work a treat so once again many thanks, now to just update the rest of the pages!!

                            Kind regards