7 Replies Latest reply on Aug 20, 2015 11:11 AM by Keenyo

    Cookies in Edge Animate

    Matbathome

      How do I get this to work in my Edge Animate site? This works in regular sites I've done. I just copy and paste this into the head of a file. However, when I do this to a page created in Edge Animate, it breaks the file to the point that I can't even open it in Edge Animate anymore. It is supposed to open a Welcome graphic and use a cookie so it doesn't always pop up.

       

       

      <script type="text/javascript" src="js/jquery.cookie.js"></script>

      <script type="text/javascript" src="shadowbox-3.0.3/shadowbox.js"></script>

      <script type="text/javascript">

      Shadowbox.init({

       

      });

       

      window.onload = function() {

              if( !$.cookie('the_cookie') ) {

       

          // open a welcome message as soon as the window loads

          Shadowbox.open({

              content:    '<div id="welcome-msg"><a onclick="Shadowbox.close()"><img src="images/welcome.png"></a></div>',

              player:     "html",

              title:      "",

              height:     528,

              width:      527

          });

      $.cookie('the_cookie', 'the_value'); }

      };

      </script>

        • 1. Re: Cookies in Edge Animate
          elainecc Adobe Employee

          Hi, Matbathome-

           

          Remember that you aren't working in markup in Animate; all of the pop-ups, Code Panel, etc. are working directly in JavaScript.  The first two lines of your HTML snippet are thee script includes, and the third section is the launch of the Shadowbox, which you probably don't need (but can still use).

           

          Here's what I would do:

          • Using the + next to the Scripts section in the Library Panel, select the JS File from Disk option, and choose jquery.cookie.js from your local disk.  If you really want to use the shadowbox, also add that in using the same method.

          scriptLoading.png

          • Secondly, in your compositionReady event, add in the section between the third <script> tags.

           

          Hope this helps!

           

          Thanks,

           

          -Elaine

          1 person found this helpful
          • 2. Re: Cookies in Edge Animate
            Matbathome Level 1

            Thanks for the help. I'm under alot of pressure to get this done quickly. The first part worked. I guess I'm confused by your second bullet point and the fact that you think I don't need Shadowbox. I think I do need shadowbox. The script in your second point calls for the shadowbox, which means I need it.

             

            Here's what I'm trying to do. We want something that installs a cookie. If it isn't installed, we want a Welcome screen to pop up, which is the graphic called "welcome.png". The people in charge of this site like Shadowbox, so I've been told I need to use it.

            • 3. Re: Cookies in Edge Animate
              Matbathome Level 1

              Here what I'm trying at this point. In the composition ready part, I've put:

              Shadowbox.init({

               

               

              });

               

               

              window.onload = function() {

                      if( !$.cookie('the_cookie') ) {

               

               

              var mySymbolObject = sym.getSymbol("welcome_graphic");

              mySymbolObject.play("welcome_screen");

               

               

              $.cookie('the_cookie', 'the_value'); }

              };

               

              It's not working yet. Not sue what to do.

              • 4. Re: Cookies in Edge Animate
                Matbathome Level 1

                I got Shadowbox to work here. If you click on "Philosopy", you can see how it funchtions. Now if I can get Fancybox to detect cookies.

                 

                http://www.mercerhrs.com/marcomm_world/test/center.html

                • 5. Re: Cookies in Edge Animate
                  hemanthR Adobe Employee

                  Why not add cookie detection code in creation complete event?

                   

                   

                  if( !$.cookie('the_cookie') ) {

                  alert("cookie added");

                  $.cookie('the_cookie', 'the_value');

                    }else{

                    alert("cookie present");

                    }

                  1 person found this helpful
                  • 6. Re: Cookies in Edge Animate
                    ristenkAdobe Level 1

                    This is the part of the code that does not work: $.cookie('the_cookie', 'the_value');

                     

                    There must be a way to make it work...

                    • 7. Re: Cookies in Edge Animate
                      Keenyo

                      Man, did you found the answer ? I need help with something with cookie in edge too haha

                      Redirect a page direct to inside an iframe with cookie