11 Replies Latest reply on Jun 29, 2009 4:33 PM by Ned Murphy

    hyperlink an swf

    stevetorn

      does anyone know how to create a hyperlink on an swf file?  i think it can be done using actionscript during the creation of the fla, but i want to see if it can be hyperlinked AFTER creation, just using the website code.

       

      thanks,

      jev

        • 1. Re: hyperlink an swf
          robdillon Most Valuable Participant

          Are you talking about making the whole swf act as an anchor link when its clicked on?

          • 2. Re: hyperlink an swf
            stevetorn Level 1

            yes.  i want to take the swf file, put it on my website and then create a hyperlink on it so that when a user clicks on the swf flash image, it takes them to the URL that it is linked to.

             

             

             

            thanks

             

            Date: Sat, 27 Jun 2009 10:25:31 -0600

            From: forums@adobe.com

            To: jevbrowser@hotmail.com

            Subject: hyperlink an swf

             

            Are you talking about making the whole swf act as an anchor link when its clicked on?

            >

            • 3. Re: hyperlink an swf
              Ned Murphy Adobe Community Professional & MVP

              As far as I know you cannot make a hyperlink out of an embedded swf file.  You could probably create a transparent image and use CSS to place that over the swf and link the image.  Another option, if you wanted to be able to change the url, would be to make the link functionality within the swf but feed the url for the link to it via FlashVars.

              • 4. Re: hyperlink an swf
                stevetorn Level 1

                thanks Ned.  Good idea.  the problem is, i don't know how to do what you just said to do.  i DO want to be able to change the URL without changing the swf file.  but i don't know how to use flashvars.  i would like to enable the functionality within the swf when i create it, but i don't know how.  can you help me?

                 

                Date: Mon, 29 Jun 2009 12:25:53 -0600

                From: forums@adobe.com

                To: jevbrowser@hotmail.com

                Subject: hyperlink an swf

                 

                As far as I know you cannot make a hyperlink out of an embedded swf file.  You could probably create a transparent image and use CSS to place that over the swf and link the image.  Another option, if you wanted to be able to change the url, would be to make the link functionality within the swf but feed the url for the link to it via FlashVars.

                >

                • 5. Re: hyperlink an swf
                  Ned Murphy Adobe Community Professional & MVP

                  What version of actionscript is your swf file published for?

                  • 6. Re: hyperlink an swf
                    stevetorn Level 1

                    3.0

                     

                    Date: Mon, 29 Jun 2009 14:41:14 -0600

                    From: forums@adobe.com

                    To: jevbrowser@hotmail.com

                    Subject: hyperlink an swf

                     

                    What version of actionscript is your swf file published for?

                    >

                    • 7. Re: hyperlink an swf
                      Ned Murphy Adobe Community Professional & MVP

                      Do you know how to code buttons in AS3?

                      • 8. Re: hyperlink an swf
                        stevetorn Level 1

                        no.  how do i do that?

                         

                        Date: Mon, 29 Jun 2009 15:41:39 -0600

                        From: forums@adobe.com

                        To: jevbrowser@hotmail.com

                        Subject: hyperlink an swf

                         

                        Do you know how to code buttons in AS3?

                        >

                        • 9. Re: hyperlink an swf
                          Ned Murphy Adobe Community Professional & MVP

                          I'm not too keen on giving lessons to folks who know nothing about Flash.  It's easy to see I'd be doing all of the work for you, which isn't why I'm here. But here's a starter for getting a button coded.  What you'll want to do is create a button that covers the entire swf stage and make it invisible (which you can do by only placing the shape of the button in it's "Hit" frame).  Then code it....

                           

                          Once you have the button created and place it over the rest of the content in a layer of its own, the first thing you need to do to make it useful code-wise is to assign it a unique instance name.  While it's selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"

                          In AS3, to make a button work with code, you need to add an event listener for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:


                          btn1.addEventListener(MouseEvent.CLICK, btn1Click);


                          The name of the unique function for processing the clicking of that button was already defined at the end of the event listener assignment, so now you just have to write that function out:


                          function btn1Click(evt:MouseEvent):void {

                             var url:String = "http://www.awebsite.com/awebpage.html";

                             var req:URLRequest = new URLRequest(url);

                             navigateToURL(req);

                          }

                          • 10. Re: hyperlink an swf
                            stevetorn Level 1

                            that's over my head.  oh well.  thanks for trying to help.

                             

                            Date: Mon, 29 Jun 2009 15:58:50 -0600

                            From: forums@adobe.com

                            To: jevbrowser@hotmail.com

                            Subject: hyperlink an swf

                             

                            I'm not too keen on giving lessons to folks who know nothing about Flash.  It's easy to see I'd be doing all of the work for you, which isn't why I'm here. But here's a starter for getting a button coded.  What you'll want to do is create a button that covers the entire swf stage and make it invisible (which you can do by only placing the shape of the button in it's "Hit" frame).  Then code it....

                             

                            Once you have the button created and place it over the rest of the content in a layer of its own, the first thing you need to do to make it useful code-wise is to assign it a unique instance name.  While it's selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"

                            In AS3, to make a button work with code, you need to add an event listener for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:

                             

                            btn1.addEventListener(MouseEvent.CLICK, btn1Click);

                             

                            The name of the unique function for processing the clicking of that button was already defined at the end of the event listener assignment, so now you just have to write that function out:

                             

                            function btn1Click(evt:MouseEvent):void {

                               var /String = "http://www.awebsite.com/awebpage.html";

                               var req:URLRequest = new URLRequest(url);

                               navigateToURL(req);

                            }

                            >

                            • 11. Re: hyperlink an swf
                              Ned Murphy Adobe Community Professional & MVP

                              You're welcome