11 Replies Latest reply on Jan 22, 2014 9:45 PM by robtwkerr

    playReverse : plays past stop point.

    robtwkerr

      So I am trying to playReverse on mouseleave but it plays all the way to the beginning of the animation. The symbol is as follows:

       

      sym.getSymbol("home").getSymbol("ballRollover").playReverse();

       

      What am I missing?

       

      PS - I am still learning Javascript. As if you couldn't tell.

        • 1. Re: playReverse : plays past stop point.
          jbowden Adobe Employee

          Do you have a sym.stop() action on a trigger somewhere on the ballRollover symbol timeline?

          • 2. Re: playReverse : plays past stop point.
            robtwkerr Level 1

            Yeah. I have one on the timeline as a trigger at the point I dont want it to playReverse past. It just seems to ignore me, my code and all my wishes. Any thoughts?

            • 3. Re: playReverse : plays past stop point.
              jbowden Adobe Employee

              Could you zip your project folder and upload it to your Creative Cloud files, and then PM me a link to download?

               

              Thanks,

              Joe

              • 4. Re: playReverse : plays past stop point.
                robtwkerr Level 1

                Thank you. I sent the link.

                • 5. Re: playReverse : plays past stop point.
                  jbowden Adobe Employee

                  Thanks Rob,

                   

                  Here's what I see:

                   

                  1. When I mouse over the home button (mouseenter event), the ballRollover timeline plays from the "rollover" label, to the end of the ballRollover timeline.
                  2. When I mouse out (mouseleave event), the ballRollover timeline does a playReverse and stops at the trigger under the "rollover" label - it doesn't playReverse beyond that (where the ball element would go back up to the top of the Stage).

                   

                  Do you see the same thing? I tested it in Safari, Firefox, and Chrome. If not, can you provide more info?

                   

                  Thanks,

                  Joe

                  • 6. Re: playReverse : plays past stop point.
                    robtwkerr Level 1

                    Try rolling over the links in the white space above a few times and the balls fly up animating in reverese. Now I clipped the home down just above the ball when its animation stops but if you rollover it a few times you can see it does the same as the others just clipped. I know I'm just not seeing something but I dont know what it is. Baffled and again very new to javascript. Thanks for looking into this for me.

                     

                    I checked it in safari and chrome. I'm a windows user, BTW.

                    • 7. Re: playReverse : plays past stop point.
                      jbowden Adobe Employee

                      Hello again,

                       

                      I see what you mean - if you mouse in and out quickly enough, especially if your mouseleave fires over the child text element, then there's a race condition occurring. The reason is every element in a symbol also has events, and they get fired whether you add code to them or not - that's the nature of HTML. And the child text element is messing up the hit testing for the symbol instance, and it ends up calling the mouseleave code even if you're not ready to playReverse yet.

                       

                      The way to fix that is to not put your mouseenter/mouseleave code on the symbol instance. but instead create a rectangle in the home symbol at the top of the elements stack that covers the entire symbol substage, and set its opacity to zero. Now put your event handlers on the invisible rectangle - because it's the top-most element, it gets all your mouse events.

                       

                      Then change your code in your mouseleave event slightly so you're getting the correct symbol, e.g.,

                       

                      sym.getSymbol.("ballRollover").playReverse();

                       

                      And getSymbol the same way for your mouseenter event on the invisible rectangle.

                       

                      That should fix the race condition.

                       

                      hth,

                      Joe

                      • 8. Re: playReverse : plays past stop point.
                        robtwkerr Level 1

                        Ok that seemed to help. But I have a question I seemed to have to put that handler on the rectangle in the home and then on the home in the stage. Doesnt a rollover work several symbols deep?

                         

                        Once again thank you. I love this program.

                        • 9. Re: playReverse : plays past stop point.
                          jbowden Adobe Employee

                          Hi Rob,

                           

                          The code in the symbol is working, and can reach down into child symbols in this way - the problem is your child text element in that symbol is stealing your mouse events and causing unpredictable event firing from the symbol instance.

                           

                          The way to avoid that in this case is to remove the code from your symbol instance (home), and instead have it only in the invisible child rectangle.

                           

                          hth,

                          Joe

                          • 10. Re: playReverse : plays past stop point.
                            robtwkerr Level 1

                            Joe,

                             

                            Got it! Once I remove the text it works without having to place the code on the stage. Also why can't I place the code on the ballrollover instead of creating a square and placing the events on that?

                             

                            Rob

                            • 11. Re: playReverse : plays past stop point.
                              robtwkerr Level 1

                              Nevermind I got. Just saw it.

                               

                              Thanks Again