5 Replies Latest reply on May 3, 2006 8:45 AM by Newsgroup_User

    javascript called from actionscript not working properly

    MacManSC
      I have a flash file that I want to change the background of an HTML frame when Scene2 begins. The code I have works fine in Safari and gives the desired result. However, calling it from firefox own Win IE, results in the javascript being placed in the address bar, and the name of the bkg image placed in the upper left corner.

      Here is the code in the flash file...
      getURL("javascript ocument.body.background='fork.jpg'");

      Here is the URL to the site http://www.nealstudio.com/ametricstest/flashtest.html

      Surely, it's something simple that I'm missing.

        • 1. Re: javascript called from actionscript not working properly
          Level 7
          MacManSC wrote:
          > I have a flash file that I want to change the background of an HTML frame when
          > Scene2 begins. The code I have works fine in Safari and gives the desired
          > result. However, calling it from firefox own Win IE, results in the javascript
          > being placed in the address bar, and the name of the bkg image placed in the
          > upper left corner.

          works ok for me (firefox 1.5.0.3 and IE 6.0 on windows 2000 sp4) - only
          odd thing I can see if that it puts '<MMString:LoadString
          id="insertbar/linebreak" />' as the page title but that is how it is set
          in the HTML, so that's to be expected.


          --
          MOLOKO
          Macromedia Certified Flash MX 2004 Developer
          Macromedia Certified Flash MX Developer
          ------------------------------------------------
          ::remove _underwear_ to reply::
          'There ain't no devil - it's just God when he's drunk' Tom Waits
          ------------------------------------------------
          GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
          VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++
          • 2. Re: javascript called from actionscript not working properly
            MacManSC Level 1
            I changed the code to make it work. Previously, I had no javascript in the HTML document. I went in and changed the js in the flash to just a call for the code in the HTML. It was my understanding that with my original code, that I didn't need to have any further js.
            • 3. Re: javascript called from actionscript not working   properly
              Level 7
              MacManSC wrote:
              > I changed the code to make it work. Previously, I had no javascript in the HTML
              > document. I went in and changed the js in the flash to just a call for the code
              > in the HTML. It was my understanding that with my original code, that I didn't
              > need to have any further js.
              >
              yes that's quite correct although you'll find it's much more robust to
              put all your javascript into functions, which should be stored in an
              external .js file. That way, if you need to change anything you mostly
              won't need to go into flash at all, just edit the function in the .js
              file. Having the external .js then allow you to include the same
              functionality on different pages in your site whilst keeping all
              functions in one place.

              --
              MOLOKO
              Macromedia Certified Flash MX 2004 Developer
              Macromedia Certified Flash MX Developer
              ------------------------------------------------
              ::remove _underwear_ to reply::
              'There ain't no devil - it's just God when he's drunk' Tom Waits
              ------------------------------------------------
              GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
              VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++
              • 4. Re: javascript called from actionscript not working   properly
                MacManSC Level 1
                Moloko, Thanks for the help. I've reposted the original problematic file. If anyone can look at it and let me know why it may be problematic. Once again, it works in Safari, but not Firefox or Win IE.

                http://nealstudio.com/ametricstest/flashtest.html
                • 5. Re: javascript called from actionscript not working     properly
                  Level 7
                  MacManSC wrote:
                  > Moloko, Thanks for the help. I've reposted the original problematic file. If
                  > anyone can look at it and let me know why it may be problematic. Once again, it
                  > works in Safari, but not Firefox or Win IE.
                  >
                  > http://nealstudio.com/ametricstest/flashtest.html
                  >
                  OK, curious, in truth I don't know. seems to be something to do with it
                  being all part of the pseudo-url. Try putting it into a javascript
                  function called changeBackground() and calling that from flash instead.

                  --
                  MOLOKO
                  Macromedia Certified Flash MX 2004 Developer
                  Macromedia Certified Flash MX Developer
                  ------------------------------------------------
                  ::remove _underwear_ to reply::
                  'There ain't no devil - it's just God when he's drunk' Tom Waits
                  ------------------------------------------------
                  GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
                  VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++