2 Replies Latest reply on Jun 13, 2006 9:39 AM by ramachan

    Javascript in Flash

    ramachan
      Greetings all,

      I have a link <a href="javascript:loadwindow(' http://www.google.com',600,400)">Geocities</a> and I have no idea how to get it to work in flash... and example of what I am talking about is at www.pandadesign.com/test.html


      Thanks
        • 1. Re: Javascript in Flash
          Level 7
          ramachan,

          > I have a link <a href="javascript:loadwindow
          > (' http://www.google.com',600,400)">Geocities</a> and
          > I have no idea how to get it to work in flash...

          Gotcha. The thing is, Flash doesn't have a JavaScript engine. Most
          browsers do, so when you want to get Flash to "run JavaScript," what really
          needs to happen is, Flash needs to tell the *browser* to run JavaScript.
          Fortunately, the getURL() function does that for you, pretty easily.

          getURL("javascript:loadwindow(' http://www.google.com',600,400)");

          Now, here's the thing. This line depends entirely on their being a
          function, loadwindow(), defined in your HTML document or in an external
          JavaScript file. JavaScript doesn't feature a loadwindow() function, so
          this must be a home made one. If so, whatever it is, it needs to be
          available ot the HTML document.

          If you want to actually use an anchor tag in a Flash text field, you'll
          simply have to highlight the word (or words) intended to be the hyperlink,
          then supply your javascript: protocol and function (just as you have them)
          in the URL link field of the Property inspector for that text field. Either
          that, or use a dynamic text field and set the TextField.html property to
          true, then set the TextField.htmlText property of that text field to the
          HTML you posted above.


          David
          stiller (at) quip (dot) net
          Dev essays: http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Javascript in Flash
            ramachan Level 1
            Thanks David it worked like a charm!