4 Replies Latest reply on Oct 31, 2006 6:00 AM by skalamichal

    GetVariable doesn't work in Firefox/Opera

    skalamichal Level 1
      Hi,

      I'm trying to get flash object variable via Javascript. But the code doesn't work for Firefox/Opera but is working well for IE. Here is an example of JS that I have used:

      var movie = window.document.flashMovie;
      movie.GetVariable("/obj:variable");
      or
      movie.GetVariable("_root.obj.variable");
      or
      movie.GetVariable("obj.variable");

      None of them is working.

      Thanks for any help.
      Michal
        • 1. Re: GetVariable doesn't work in Firefox/Opera
          anonymous thing Level 1
          var bolIsIE = (navigator.appName.indexOf("Microsoft") != -1);
          var objFlash;

          objFlash = (bolIsIE) ? window["yourFlashId"] : document.embeds["yourFlashId"];
          // objFlash.GetVariable....

          In Gecko browser, to get a Flash object you must use document.embeds which is an array of all the Flash object in the page. Don't forget that IE use window and Gecko work with document.
          • 2. Re: GetVariable doesn't work in Firefox/Opera
            skalamichal Level 1
            Thanks, but this isn't an issue.

            The window.document.flashMovie will return the correct flash object/embed flash movie.
            The issue is that the GetVariable method wont return the object variable. When you try to get an simple variable that is in the _root timeline, it will return the value. Example:
            movie.GetVariable(_url) will return the url of the flash movie without any problem.

            But when you create an ActionScript class with userName property and then you will create the instance of it in the _root, you should be able to get it's value. Example:
            Flash:
            var obj = new SomeClass();
            obj.userName = "peter";
            JavaScript:
            movie.GetVariable("/obj:userName");
            or
            movie.GetVariable("obj.userName");

            This will return Peter for IE and null for Forefox/Opera.
            The same when you use the document.embeds[..].
            • 3. GetVariable doesn't work in Firefox/Opera
              skalamichal Level 1
              I wonder if anybody can help me with this.
              I just need to know, if this is an issue in flash player plugin ? Or it shouldn't work in IE too ?

              Thanks again for any help any response.

              Michal
              • 4. Re: GetVariable doesn't work in Firefox/Opera
                skalamichal Level 1
                I wonder if anybody can help me with this.
                I just need to know, if this is an issue in flash player plugin ? Or it shouldn't work in IE too ?

                Thanks again for any help any response.

                Michal