7 Replies Latest reply on Sep 14, 2007 9:59 PM by kglad

    Stop movie from playing on refresh?

    Dkmafia
      I recently had to edit a link on the flash banner. Previously it played once and I assume had a cookie to prevent replays every time you changed pages. Now it plays EVERY TIME. Please help. I would like to play once for a new user, then thats it.
        • 1. Re: Stop movie from playing on refresh?
          kglad Adobe Community Professional & MVP
          use the flash sharedobject class.
          • 2. Re: Stop movie from playing on refresh?
            Dkmafia Level 1
            I googled it and from what I read it not only sounds like what I want, but it looks like I could have something similar. Please keep in mind other then making a dot run across the screen or editing links, I am pretty flash ignorant.

            Update: I looked at the page on another comp and was able to surf around the site with the header not refreshing, like it used to. As soon as I refreshed a page using the button on my browser, the flash restarted everytime I changed pages.

            So confused :(
            • 3. Re: Stop movie from playing on refresh?
              kglad Adobe Community Professional & MVP
              what causes your banner to play? does you swf consist of a main timeline with animation on that timeline? or something more?
              • 4. Stop movie from playing on refresh?
                Dkmafia Level 1
                I didnt make it. I have no idea. Would see'ing it help? ShopL2.com

                I do know when the site was built it played every time and I asked they make it play only once. If it was a Macromedia option then when I installed the original again it would of stopped, it didnt. If it is a script or other code issue why would it be affected? I only changed the movie, no code. Doesnt make any sense to me.

                I see a:

                // Universal set cookie script
                // checks the date first
                // deletes existing cookie
                // sets new cookie

                Could this be for the flash? Do I need to reset it somehow?
                • 5. Re: Stop movie from playing on refresh?
                  kglad Adobe Community Professional & MVP
                  copy and paste the code or post a link to the fla.
                  • 6. Re: Stop movie from playing on refresh?
                    Dkmafia Level 1
                    <script type="text/javascript" language="JavaScript">
                    function setCookie ( name, values, expires )
                    {
                    // Universal set cookie script
                    // checks the date first
                    // deletes existing cookie
                    // sets new cookie

                    if ( !expires )
                    {
                    expires = new Date ();
                    }

                    delCookie ( name );

                    document.cookie = name + "=" + escape ( values ) + "; expires=" + expires.toGMTString() + "; path=/";
                    }
                    function getCookie ( name )
                    {
                    // call the cookie previously set based on the "name" value
                    // submitted through the function

                    var cookiestring = document.cookie;
                    var cookiename = name + "=";
                    var cookielength = cookiestring.length;

                    var cookiebegin = 0;

                    while ( cookiebegin < cookielength )
                    {
                    var vbegin = cookiebegin + cookiename.length;

                    if ( cookiestring.substring ( cookiebegin, vbegin ) == cookiename )
                    {
                    var vend = cookiestring.indexOf ( ";", vbegin );

                    if ( vend == -1 )
                    {
                    vend = cookielength;
                    }

                    return unescape ( cookiestring.substring ( vbegin, vend ) );
                    }

                    cookiebegin = cookiestring.indexOf ( " ", cookiebegin ) + 1;

                    if ( cookiebegin == 0 )
                    {
                    break;
                    }
                    }

                    return null;
                    }

                    function delCookie ( name )
                    {
                    // Simple script to delete a cookie
                    // sets time to Jan 1st, 1970, with no value

                    document.cookie = name + "= ; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/";
                    }

                    var mode=getCookie("mode");

                    // expire 365 days from now
                    var expdate = new Date ();
                    expdate.setTime ( expdate.getTime () + ( 1000 * 60 * 60 * 24 * 365 ) );

                    // set cookie
                    setCookie ( "mode", "1", expdate );

                    if (mode != "1")
                    {
                    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="114" id="lanlabsheader" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="../flash/lanlabsheader.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="../flash/lanlabsheader.swf" quality="high" bgcolor="#000000" width="900" height="114" name="lanlabsheader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" /></object>');
                    } else {
                    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="114" id="lanlabsheader" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="../flash/lanlabsheader.swf?movieSkip=true" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="../flash/lanlabsheader.swf?movieSkip=true" quality="high" bgcolor="#000000" width="900" height="114" name="lanlabsheader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" /></object>');
                    }
                    </script>
                    • 7. Re: Stop movie from playing on refresh?
                      kglad Adobe Community Professional & MVP
                      just delete all the javascript for the cookie. javascript implementation varies so much from browser to browser, it's much less risky setting a cookie with the flash sharedobject.

                      post a link to your fla so i can see how to control its play.