3 Replies Latest reply on Oct 23, 2007 5:24 AM by Ex Malterra

    Do Flash getURL links work when SWF is embedded in Director?

    Applied CD Level 1
      I’ve got a simple test rig that says no, the links won’t work. Anybody get this to work?

      My test rig has two buttons in Flash, one gets a pdf from a remote server, the other opens a local PDF on my hard drive.

      When played from the Flash player the local link works fine, the remote link looks like it would work if I were willing to change my security settings and restart.

      When embedded in Director both links are inactive.

      And, although this is not terribly relevant, when the SWF is played remotely through a browser, the remote link works
        • 1. Re: Do Flash getURL links work when SWF is embedded in Director?
          robdillon Most Valuable Participant
          Your Flash .swf is expecting to be housed in an HTML doc, and so a getURL function is trying to reach out to the browser. When you import your .swf into a Director movie, that Director movie is taking the place of the browser window. So your function fails to reach a browser. This is compounded if you are playing the .swf from a Director projector as there's no browser immediately available.

          There is a simple solution. You can use the on getURL me,string function in Director to intercept the url.

          So, if your Flash movie has something like this:

          ------------
          myButton.onRelease = function() {
          getURL("www.disney.com",_blank);
          }
          ------------

          Then in your Director movie, write a behavior something like this:

          ----------------
          property thisSprite

          on beginSprite me
          thisSprite = me.spriteNum
          end

          on getURL me,link,target
          gotoNetPage link,target
          end
          -------------

          Then attach that behavior to the Flash sprite.
          • 2. Do Flash getURL links work when SWF is embedded in Director?
            Applied CD Level 1
            Thanks Rob, I didn’t know you could intercept a valid action script call. In my case the client supplied SWF (not my test rig) used getURL to pass a call to a javascript window opener so the link wasn’t a simple URL but it was no big deal to parse out the address and it works fine.
            • 3. Re: Do Flash getURL links work when SWF is embedded in Director?
              Ex Malterra Level 1
              you can also use swfs to call lingo/javascript syntax in director, either handlers/functions or direct lingo/javascript syntax calls.

              the following in a swf will open a director alert:

              getURL("Lingo:_player.alert(\"This Alert is called from Flash\")");

              and if you define this javascript funtion in a movie script

              function doAlert(theMessage)
              {
              _player.alert(theMessage);
              }

              you can call it from a swf like this

              getURL("Lingo:doAlert(\"This Alert is called from a Flash call\nto a javascript function in Director\")");