5 Replies Latest reply on Nov 30, 2006 9:44 AM by derobinson

    How Do I not Reload Flash when page is reloaded?

    pyollin
      I have a flash animation playing in a table on a ColdFusion page. It is a rather long movie (45 seconds) and I have a stop action at the end of it. The final frame has several navigation points into the site.

      Is there a way, that I can tell flash not to reload the page if the pages is being reloaded from within the site or by someone using tthe back button? I'm pretty new at this and any help would be appreciated.

      Thank you.
        • 1. Re: How Do I not Reload Flash when page is reloaded?
          derobinson Level 1
          You would need to set a Shared Object from Flash (basically a Flash cookie) which you could then check against on load of the movie. If it exists, then skip the animation to the last frame and stop, otherwise play the animation. Search for Shared Object in the help files to get you started.

          N.B. pay attention to security settings so you don't run into the Flash security sandbox.

          good luck!
          • 2. Re: How Do I not Reload Flash when page is reloaded?
            pyollin Level 1
            Thanks for the help. I look up Shared Objects and I guress I'm just to new at this, but I really couldn't make sens of how to do it. All I really wnat to do is have the movie not play when the user returns to the "index.cfm' page. Would it be asking to much to ask you to post an example?

            Thanks in advance.

            Peter
            • 3. Re: How Do I not Reload Flash when page is reloaded?
              clbeech Level 3
              I don't know much about ColdFusion yet, but I have one idea. If you were to create a global boolean variable that is set to "true' at the begining of your animation (but not within the animation MovieClip itself) and then gets set to "false" once it's complete, you could set up an IF statement on the first frame of the animation to check if it's been played. not sure if this will help. If the new page call opens a URL (like "index.cfm" ) in a different frame or something, and the SWF isn't getting reloaded, this may work. However, if the SWF gets reloaded in the process and the initial variable is first set within it, this won't work. Just some thoughts, probably not very good ones : )
              • 4. Re: How Do I not Reload Flash when page is reloaded?
                Jeff_Hight
                You might try using a session variable and make that available to your flash movie either via FLASHVARS or loadVariables....
                • 5. Re: How Do I not Reload Flash when page is reloaded?
                  derobinson Level 1
                  The CF Session variable would work, but only for the life of the session. Setting the variable as a Flash Shared Object would be a more "permanent" solution. Either way, the first bit of AS in your Flash file should check for the variable (if doing the SO, then all you need to do is check for its existance, if passing a variable in from CF, then check its value). So for an SO, something like this:

                  var mySO:SharedObject = SharedObject.getLocal("playVar");
                  if (mySO.played != undefined) {
                  this.gotoAndStop(endOfMovie);
                  } else {
                  mySO.played = "yes";
                  this.play();
                  }

                  Hope that helps!