5 Replies Latest reply on Jan 19, 2007 10:49 PM by Newsgroup_User

    Button and JavaScript link (help)

    michael-
      I would like to know how to make a link to open in to a new window and..., I have been using javascript links to open images in small windows; <a href="images/samples/SampleSC.gif" onclick="return popitup('images/samples/SampleSC.gif')"> These links work in the html, and I would like to add this link to a button(or something) in flash 8

      The following is in my html to make the links work, but if I just get the above link somehow imbedded in to a button I think it will work from there

      <script language="javascript" type="text/javascript">
      function popitup(url) {
      newwindow=window.open(url,'name','height=490,width=720,scrollbars=yes');
      if (window.focus) {newwindow.focus()}
      return false;
      }
      </script>



      I am so new to this. I have tried adding the following to the action script but it did not work;

      homepage_btn.onRelease = function () {
      getURL(" http://www.macromedia.com", "_blank");
      };

      I found the following ways to do this http://www.abcpchelp.com/temp/URL2.htm but either I did not know how to use them or they did not work

      The flash file I am working on is here: http://www.msresume.com.au/Default1Draft.aspx (the links will be in the sample thumbnails)

      Thank you, your time is appreciated!
        • 1. Re: Button and JavaScript link (help)
          Level 7


          michael- wrote:
          > I would like to know how to make a link to open in to a new window and..., I
          > have been using javascript links to open images in small windows; <a
          > href="images/samples/SampleSC.gif" onclick="return
          > popitup('images/samples/SampleSC.gif')"> These links work in the html, and I
          > would like to add this link to a button(or something) in flash 8
          >
          > The following is in my html to make the links work, but if I just get the
          > above link somehow imbedded in to a button I think it will work from there
          >
          > <script language="javascript" type="text/javascript">
          > function popitup(url) {
          > newwindow=window.open(url,'name','height=490,width=720,scrollbars=yes');
          > if (window.focus) {newwindow.focus()}
          > return false;
          > }
          > </script>
          >

          All you need is one simple line in flash an none of the HTML stuff.

          getURL("javascript:n_name=window.open('page.htm','thewin','width=720,height=490,scrollbars =yes');void(0);");


          Take note tho, this might not work tested locally. You need to upload to server and
          test it online.
          Now, if you have multiple windows, change the "thewin" to something like "thewin1" "thewin2" etc...
          If you keep requesting window with same name, you end up loading other content into it.
          New name assure new object and new window made.



          --
          Best Regards

          Urami


          --

          !!!!!!! Merry Christmas !!!!!!!
          &
          Happy New Year


          <urami>
          If you want to mail me - DO NOT LAUGH AT MY ADDRESS
          </urami>
          • 2. Re: Button and JavaScript link (help)
            michael- Level 1
            Is: n_name the name of the button?

            and do I click on the frame or button and go to the action script and just past this in

            Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!
            • 3. Re: Button and JavaScript link (help)
              Level 7


              michael- wrote:
              > Is: n_name the name of the button?

              no, that's javascript function name. Do not touch this one :)

              If you want to add it to button instance:

              on (release) {
              getURL("javascript:n_name=window.open('page.htm','thewin','width=720,height=490,scrollbars =yes');void(0);");
              }



              > and do I click on the frame or button and go to the action script and just past this in

              Click on a button, hit F9 to open action editor and paste in the above.
              GET URL is one line action, make sure that while paste it might wrap it into
              two lines and cause error while testing.

              --
              Best Regards

              Urami


              --

              !!!!!!! Merry Christmas !!!!!!!
              &
              Happy New Year


              <urami>
              If you want to mail me - DO NOT LAUGH AT MY ADDRESS
              </urami>
              • 4. Re: Button and JavaScript link (help)
                michael- Level 1
                Thank you, that worked! I am please that you have given me an answer that worked, what would I do with out you.
                • 5. Re: Button and JavaScript link (help)
                  Level 7

                  > Thank you, that worked! I am please that you have given me an answer that worked, what would I do with out you.

                  Most welcome :)
                  glad you got it working Michael

                  you have a nice weekend, whatever left of it :)

                  --
                  Best Regards

                  Urami


                  --

                  !!!!!!! Merry Christmas !!!!!!!
                  &
                  Happy New Year


                  <urami>
                  If you want to mail me - DO NOT LAUGH AT MY ADDRESS
                  </urami>