7 Replies Latest reply on Jun 24, 2013 4:34 PM by tahneeg

    Coding events over time

    tahneeg Level 1

      Hello! I'm currently playing with EA for a little episodic game. I really want to have a 'home' image that has elements that load .gifs when buttons are clicked.


      My thought was to go with the solution on this page for loading my gifs so they load every time a button is pressed, allowing them to be played multiple times:


      I would then know the exact duration of each .gif in milliseconds, and tell it to load the static 'home' image once said milleseconds would pass.




      >hide buttons

      >load gif

      >play for x seconds

      >load jpg 'home' image

      >show buttons
      (rinse, repeat)


      Also, if anyone has other suggestions for how to accomplish playing different animations from a 'home' image with multiple buttons, that would be excellent! My only other solution has been to load in individual images as a sequence in the timeline. While this works and I can easily skip around the timeline, the image exports get to be very large. I really like how compressed .gif animations are, and it doesn't look like EA allows for starting a gif fresh each time it's referenced in the timeline, so I figured loading it every time would be the best solution.

      I'm going to be making a lot of these episodes and would like to avoid sprite sheets, as they are super labor-intensive and I will be dealing with tons of frames.



      After more testing, I was loading 3 different gifs and noticed that they all did not load 'fresh' upon each click; it's as if they were still in their own timeline that played on loop, which was called to whenever its corresponding button was clicked. They all need to play from their first frame.


      So I'm thinking this method will not work... Is there a way of reloading gifs so that they're guaranteed to always play from the first frame?


      Also, I wonder if there's a way of calling another symbol that's not in the main stage, as a way of cheating to always get to the first frame?

      I could export jpg sequences of my animations, but there are going to be dozens of files to load and sort out in the timeline, which isn't nearly as effective as gifs.


      Any thoughts are much appreciated! I just want to figure out a really quick method of doing this so I can focus on animation, then plug everything in EA.


      I do recognize that this would be easier to accomplish in Flash, but I was hoping to go for a lightweight HTML alternative that would be guaranteed cross-browser/mobile/etc.


      Thanks, I really am excited to get this project going!

        • 1. Re: Coding events over time
          jbowden Adobe Employee

          Hi there,


          As the author of that workaround and the example file, I can assure you that when you load a GIF source into a background image, it will indeed always play from the beginning. Maybe you can describe what you're doing in more detail, or provide an example file?




          1 person found this helpful
          • 2. Re: Coding events over time
            tahneeg Level 1

            Hey Joe,
            Thanks for your reply! Here's my source:


            They might load fresh on the first play, but after that it seems like they want to run off of their existing looping timeline.

            I'll look into making the gifs not loop, maybe that's the answer?


            Thanks so much!!

            • 3. Re: Coding events over time
              jbowden Adobe Employee

              Hello again,


              Now that's strange...your example file doesn't load any of the GIF files for me in the browser. Seems that the loader image is somehow problematic - it doesn't show selection on the Stage at all. Where did transparent.png file come from? Are the same example files working correctly for you?




              1 person found this helpful
              • 4. Re: Coding events over time
                tahneeg Level 1

                Oh my snaps! I was working locally off a file that hadn't been saved, MY APOLOGIES!
                I just updated the .zip to the proper file.
                Sorry again! And thanks so much for helping out!

                • 5. Re: Coding events over time
                  tahneeg Level 1

                  After some more research and experimenting (even with exporting Flash with JS), I've found that if I keep my color palettes extremely limited I can export PNGs that aren't too massive, and keep each 'episode' under a megabyte. I then sequenced out the PNGs, and... well, it seems to be working!
                  I put each PNG sequence into the main timeline, then turned on/off visibility one by one, then converted all those layers into a single symbol, and had that symbol placed in the timeline alongside other ones, and alongside other buttons.
                  It looks like this method is probably going to work. So far it's happy across Mac/PC/iPhone/Android (no surprises, but better to have that confirmed!)

                  Thanks again for your time, Joe!

                  • 6. Re: Coding events over time
                    jbowden Adobe Employee

                    Hi tahneeg,


                    I did get your updated composition files. Oddly, each button click in your file does indeed restart each GIF from the beginning on webkit-based browsers (Chrome & Safari), but not in IE10 or Firefox. I tried various workarounds to get it to work as expected in IE & FF, but with no luck so far.


                    Although it's a workaround for an unsupported feature (animated GIF control in browsers), I'm still curious as to why this case doesn't work. I'll poke around a bit more and if I find any further info or workarounds, I'll update this thread.




                    • 7. Re: Coding events over time
                      tahneeg Level 1

                      Hey Joe,
                      Oh strange! It totally does work in webkit browsers!
                      Even though I did find a work-around that's pretty simple, it would be even more efficient if it did work with gifs.