13 Replies Latest reply on Oct 16, 2009 8:22 AM by acath

    make a button go to a specified URL

    dbasner

      I have just about made my entire in flash catalyst website when I realized that I had no way to make a button go to a different website,not a state of my own.   I am unsure if this can be done within catalyst, or if flash builder is needed.  I know nothing about flash builder, if it is neccesary for me to use flash builder or whatever other program is necessary, if you could tell me exactly what needs to happen, that would be great!

       

      Thank You!

      dbasner

        • 1. Re: make a button go to a specified URL
          Tara Jane Feener

          Hey!

          So there was a question about this very thing yesterday.

          Check out this thread: http://forums.adobe.com/thread/478645?tstart=0

          Let me know if it works out for you/you need any additional help.

          Tara

          • 2. Re: make a button go to a specified URL
            dbasner Level 1

            So I would put:   

            <s:Button click="handleClick()"/>

             

            somewhere on the page, anywhere? the beginning?

             

            and then after that I would put between :

             

            <fx:Script>

            <![CDATA[

            protected function handleClick():void

            {

                 navigateToURL( new URLRequest("http://www.adobe.com"), "_self");

            }

            ]]>

             

            </fx:Script>

             

            the other person said that by clicking on the button and by going back to code mode it would show where the <s;button> tag would be, is that where both snippets of text go? I know nothing about flash builder and your help would be amazing!

            • 3. Re: make a button go to a specified URL
              SupraJohde

              This is how i did it.

               

              When you have made button. Rename it something logical. Example, if u have banner which is a button to adobe.com site. Rename button to "adobe".

              Select button in "DESIGN" mode and go to "CODE" mode. The snippet of code should be now selected relating to button. You should see on the right side PROJECT NAVIGATOR window. Open folder and there you should see "src" folder. There u should see Fx file named Main.mxml.

              Select it and press with your right mouse button "Open with-> text editor". This will allow you to edit the actual code. The selected code should look something like this <s:Button x="52" y="557" skinClass="components.Button1" d:userLabel="BUTTONNAME"/> Then you add snippet of code like this. click="navigateToURL( new URLRequest('PUT HERE YOUR URL'), '_self');" If you want page open in another window change "_self" to "_blank".

              • 4. Re: make a button go to a specified URL
                muddpuppie

                Hi SupraJ,

                i tried the snippet of code you mentioned, with a correct url and when i went to preview it FC said that it could not launch it in webbrowser due to error.

                do i leave a space or is it in the next line after the specific line of code you mention?

                 

                cheers

                Mudd

                • 5. Re: make a button go to a specified URL
                  SupraJohde Level 1

                  Oh yeah, forgot to mention. Don't know is it this precise code or what but it will work only on the server. You can't run it locally. The link should work when you "Run Project". But if you publish it to SWF and try to run it on your on computer it won't work. But if u have some server where to put it will work.

                   

                  Here is example how i used it.

                  <s:Button x="929" y="709" skinClass="components.Button12" d:userLabel="nebula" click="navigateToURL( new URLRequest('http://www.nebula.fi'), '_blank');"/>

                  • 6. Re: make a button go to a specified URL
                    dbasner Level 1

                    THANKS! that made it so much clearer, this is a feature that should be

                    available in catalyst as a button option in the next release, do you know if

                    it will / when the next beta will be?

                    -Daniel Basner

                     

                     

                    2009/8/23 SupraJohde <forums@adobe.com>

                     

                    This is how i did it.

                    >

                    When you have made button. Rename it something logical. Example, if u have

                    banner which is a button to adobe.com site. Rename button to "adobe".

                    Select button in "DESIGN" mode and go to "CODE" mode. The snippet of code

                    should be now selected relating to button. You should see on the right side

                    PROJECT NAVIGATOR window. Open folder and there you should see "src" folder.

                    There u should see Fx file named Main.mxml.

                    Select it and press with your right mouse button "Open with-> text editor".

                    This will allow you to edit the actual code. The selected code should look

                    something like this <s:Button x="52" y="557" skinClass="components.Button1"

                    d:userLabel="BUTTONNAME"/> Then you add snippet of code like this.

                    click="navigateToURL( new URLRequest('PUT HERE YOUR URL'), '_self');" If you

                    want page open in another window change "_self" to "_blank".

                    >

                    • 7. Re: make a button go to a specified URL
                      djordan79 Level 1

                      i think it is easier than doing all of that... i could be wrong though;]

                       

                      this is what i did and it works great...

                       

                      import your catalyst project into flash builder...

                      open the main.mxml file found in the src folder...

                      in design view, go to whatever "state" that holds your links...

                      highlight your link and in the properties panel on the right you should see

                      a "on click" text field... then just enter the following code there:

                       

                      navigateToURL( new URLRequest("http://www.whateversiteyouwant.com"), "_blank");

                       

                      that easy... you don't even need to go into source mode

                       

                      url.jpg

                      • 8. Re: make a button go to a specified URL
                        trancepriest

                        The problem with this method is that it creates links for only the current state that you are in. When you switch to another state the links are not operable. It's a great solution for links that only apply to the current page state but not for menu navigation links.

                        • 9. Re: make a button go to a specified URL
                          Tvoliter Adobe Employee

                          Flash Catalyst Beta II is now available and going to a specific URL is now really easy.

                           

                          1. Select a button

                          2. In the Interactions Panel choose "On Click" and "Go to URL"

                          3. Enter the URL in the text field that appears

                           

                          Get Beta II here:

                          http://labs.adobe.com/technologies/flashcatalyst/

                           

                          Ty

                          • 10. Re: make a button go to a specified URL
                            coltonholliday81

                            Thank you djordan79 SO MUCH. I just saved my ***. That was super easy. Everyone use this technique!

                            • 11. Re: make a button go to a specified URL
                              Ege Sezen

                              I have a body text layer that it is used as a content for a specific link like "about":

                               

                              "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis, magna a faucibus varius, lacus ipsum dictum nisl, at facilisis lacus magna vitae elit. Donec ut est semper justo dignissim tempor. Pellentesque feugiat laoreet ultrices. In neque ipsum, laoreet sed molestie quis, euismod in massa. Suspendisse mauris ligula, pellentesque a mattis in, mollis nec nunc. Nam tristique rhoncus porttitor. Vestibulum vestibulum libero id lectus scelerisque ultricies".

                               

                              I want to make ultricies behave as a button which makes the user go to a specific url when it is clicked on. It is like hyperlinking in html.

                               

                              The problem is the following. The body text is imported as a single layer. I cannot select and make ultricies individually as a button. I can only select and make the whole text as a button.

                               

                              You may give me a solution like this: Separate the layers as ultricies and the rest. It is a temporary solution but I guess you see the real deal.    

                               

                              Thanks,

                              Ege.

                              • 12. Re: make a button go to a specified URL
                                coltonholliday81 Level 1

                                Ty, it says that if you get beta2 that it wont even let you open a project that you made i beta1?! well good does that do anyone? i still cant make links. even flash builder will only let me make one link, and none of the others even work.....

                                • 13. Re: make a button go to a specified URL
                                  acath Level 4

                                  Hi Colton,

                                   

                                  Unfortunately, the project format changed significantly between Beta 1 and Beta 2, and it would be rather time-consuming for us to create an upgrader for every version of pre-released software. We've chosen to focus on shipping the best possible 1.0 product rather than spending time ensuring compatibility between pre-release versions. Our apologies if this messes up your workflow...

                                   

                                  If you're using Flash Builder, you can integrate content from both FC Beta 1 and Beta 2 by importing multiple FXPs into the same Flash Builder project. Here's what I'd suggest:

                                   

                                  1.  Take your FC Beta 1 project and import it into FB beta 2.

                                  2.  Create the links in FC Beta 2, using the workflow Ty recommended.

                                  3.  Import your FC Beta 2 project into FB.

                                  4.  Merge the two projects - you should be able to do this just by dragging some files around.

                                   

                                  -Adam