5 Replies Latest reply on Mar 27, 2010 5:12 AM by M.R.Biesheuvel

    Onload Problem works with IE but nothing else

    leighd7 Level 1

      I have a flash file in my page which I control the time line

      from buttons . Code as follows.

       

      I load my swf into a container div with swfobject.

       


      var flashvars = {};
      var params = {};
      params.menu = "false";
      params.wmode = "opaque";
      var attributes = {};
      attributes.id = "FlashIntro";
      swfobject.embedSWF("./Flash/Banner.swf", "Flashmovie", "914", "201", "8.0.0", "./Flash/expressInstall.swf", flashvars, params, attributes);

       

      I control its timeline with this code.

       

      function thisMovie(movieName) {
        // IE and Netscape refer to the movie object differently.
        // This function returns the appropriate syntax depending on the browser.
        if (navigator.appName.indexOf ("Microsoft") !=-1) {
          return window[movieName]
        } else {
          return document[movieName]
        }
      }
      // Checks if movie is completely loaded.
      // Returns true if yes, false if no.
      function movieIsLoaded (theMovie) {
        if (typeof(theMovie) != "undefined") {
          return theMovie.PercentLoaded() == 100;
        } else {
          return false;
        }
      }
      function go(theFrame) {
        if (movieIsLoaded(thisMovie(movieName))) {
          thisMovie(movieName).GotoFrame(theFrame);
        }
      }

       

      The function go is run onload in the body tag.

       

       

       

      set up cookies
      //Get cookie routine by Shelley Powers
      function get_cookie(Name) {
        var search = Name + "="
        var returnvalue = "";
        if (document.cookie.length > 0) {
          offset = document.cookie.indexOf(search)
          // if cookie exists
          if (offset != -1) {
            offset += search.length
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1) end = document.cookie.length;
            returnvalue=unescape(document.cookie.substring(offset, end))
            }
         }
        return returnvalue;
      }

      function blue() { document.cookie="sitename=0" ;}
      function green() { document.cookie="sitename=1" ; }
      function red() { document.cookie="sitename=2"; }
      function orange() { document.cookie="sitename=3" ;}
      function yellow() { document.cookie="sitename=4" ; }
      function purple() { document.cookie="sitename=5" ;}

      set variable result to positon in timeline

       

      var result=get_cookie("sitename");

       

       

      The functions above control the timeline position and set a cookie variable result is last position so when you leave the page it remembers last position.


      <body onload="go(result);">

       

      It works fine in IE but any other browser it don't work.


      <body onload="go(result);">

       

       

       

      Please can anyone advise me