15 Replies Latest reply on Sep 11, 2007 3:14 PM by Newsgroup_User

    What the heck is wrong with AS 3.0?

    C-Rock Level 2
      I'm having a whale of a time with rollovers in AS 3.0. In this app:
      RexMap

      The bottom buttons are simple movieclips with an up and over state.
      When you rollover and out of them they are very buggy. They have listeners and that is is. myButton.gotoAndPlay("over");

      The button to the left of the one with the green arrow. This is for the visible elements on the application. When the pop-up comes up, "MOUSE_OVER" doesn't work at all!!!! Why?

      "ROLL_OVER" is extremely buggy. Try it, works maybe half the time.

      I've been programming in AS for 5 years and 2.0 was perfect with the rollovers of movieclips. Should I be doing something different, or is this AS 3.0, for now?

      Thanks,

      C
        • 1. Re: What the heck is wrong with AS 3.0?
          Level 7
          C-Rock,

          > The bottom buttons are simple movieclips with an up
          > and over state. When you rollover and out of them
          > they are very buggy.

          Not sure what you mean. They look fine to me -- but maybe I'm not
          seeing what you're seeing.

          > They have listeners and
          > that is is. myButton.gotoAndPlay("over");

          Would you show the full event handler? Let's take a look.

          > The button to the left of the one with the green arrow.
          > This is for the visible elements on the application. When
          > the pop-up comes up, "MOUSE_OVER" doesn't work
          > at all!!!! Why?

          When I click the icon described, I see a blue swatch appear over most of
          the background.
          That swatch is completely blocking the icon buttons, which blocks their
          events. Give that blue area an instance name and set its
          MovieClip.mouseEnabled and MovieClip.mouseChildren properties to false.

          > "ROLL_OVER" is extremely buggy. Try it, works maybe
          > half the time.

          I don't know what to say, C-Rock; it works for me consistently.

          > I've been programming in AS for 5 years and 2.0 was
          > perfect with the rollovers of movieclips. Should I be
          > doing something different, or is this AS 3.0, for now?

          Well, plenty has changed, for sure. The event model in AS3 is
          considerably more consistent across the board. In addition, it's more
          finely grained and more powerful (more things possible, more events to
          handle). Again, let's see the code you're using ... maybe you've missed
          something.


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."


          • 2. Re: What the heck is wrong with AS 3.0?
            scoots101
            For rollover try:

            myButton.addEventListener(MouseEvent.ROLL_OVER, myButtonOver);

            function myButtonOver(event:MouseEvent): void
            {
            //add properties here
            }

            For rollout try:

            myButton.addEventListener(MouseEvent.ROLL_OUT, myButtonOut);

            function myButtonOut(event:MouseEvent): void
            {
            //add properties here
            }
            • 3. Re: What the heck is wrong with AS 3.0?
              C-Rock Level 2
              My buttons are just simple movie clips with 10 frames representing the "over" state and 10 frames representing the "up" state.

              ??

              The main problem is really with the pop up window and the "ok" and "cancel" buttons
              • 4. Re: What the heck is wrong with AS 3.0?
                C-Rock Level 2
                scoots101 that is most definitely what i'm using. as you can see above.
                • 5. Re: What the heck is wrong with AS 3.0?
                  C-Rock Level 2
                  Here's the code for the ok and cancel buttons

                  thanks for your help, everyone.
                  • 7. Re: What the heck is wrong with AS 3.0?
                    C-Rock Level 2
                    i'm not using the button component, i'm using movieclips...
                    • 8. Re: What the heck is wrong with AS 3.0?
                      C-Rock Level 2
                      David,

                      I tried using the mouseEnabled and the mouseChildren to improve performance of the highest buttons when the pop-up is up. The "ok" and "cancel" buttons still work like crap. Go back and forth between them quickly a few times, the rollovers don't work everytime.

                      C
                      • 9. Re: What the heck is wrong with AS 3.0?
                        Level 7
                        C-Rock,

                        > I tried using the mouseEnabled and the mouseChildren
                        > to improve performance of the highest buttons when the
                        > pop-up is up. The "ok" and "cancel" buttons still work
                        > like crap.

                        I may not have understood what you were after at first. In my initial
                        reply, I was thinking you wanted the icon buttons along the bottom to
                        continue to respond when the blue swatch was obscuring them.

                        At this point, I can see what you mean about the OK and Cancel buttons:
                        it's easy to fool them by rapidly shaking the mouse. From what I'm seeing,
                        I have the following thoughts: your events may be firing more than once,
                        because the interior elements of your buttons (the lettering, the curve
                        shape) may be active child objects of the buttons themselves -- for example,
                        if your text fields are dynamic or of the shapes are movie clips. So you
                        may want to set those buttons' mouseChildren properties to false ...

                        elementsPopup.boxMC.okBTN.mouseChildren = false;
                        elementsPopup.boxMC.okBTN.addEventListener(MouseEvent.ROLL_OVER,
                        elementsOkOver);

                        I realize you just said you did that -- and I believe you -- but since
                        your earlier code samples don't show as much, I wanted to cover all the
                        bases. I'm also noticing that the hit area of these buttons seems to extend
                        past the edge of the button artwork itself (just for the OK/Cancel). That
                        might be another mouse child culprit.

                        The overall framerate of your movie may be an issue here, too.

                        Since these buttons don't seem to tween, by not bypass movie clips for
                        the time being and use button symbols? That may rescue you a few headaches
                        for the moment and buy you time to experiment with movie clip event handlers
                        later.

                        Your code looks fine, so I'm interested to know if the same code
                        succeeds for you in cases where the artwork is flat-out dull. Start a new
                        FLA and whip up a quick movie clip-based button whose artwork is simply
                        comprised of identical squares (graphics or simply shapes). Use the
                        MOUSE_OVER event. Should work as expected. Now introduce text (dynamic and
                        static) to see how the event handling changes unless you specify
                        mouseChildren = false (use trace() to test). If mouseChildren is true
                        (default), you'll see your trace() get triggered every time you mouse away
                        from the dynamic text "back on" to the simple square background. This isn't
                        the case for ROLL_OVER, regardless of the mouseChildren setting.

                        So you can see that granularity and subtlety have increased, at least in
                        this scenario. Conceptually, event handling is still the same, but some of
                        the finer details have changed a bit.

                        Chin up! :)


                        David Stiller
                        Contributor, How to Cheat in Flash CS3
                        http://tinyurl.com/2cp6na
                        "Luck is the residue of good design."


                        • 10. Re: What the heck is wrong with AS 3.0?
                          Damon Edwards Level 3
                          I was just rolling over and out of your 'OK' button, and it crashed firefox on my Mac..
                          • 11. Re: What the heck is wrong with AS 3.0?
                            C-Rock Level 2
                            firefox and mac hate flash so i'll worry about fixing those later. 94% of users on this site use PC and 72% have flash player 9.0.24 or later installed.

                            mac almost never works 100% with flash? for instance try adding a transparent window feature to a site that has 500 kb's of size or larger cached in the browser. it plays at about 1 frame per second. i worked with adobe for a month trying to fix it but to no avail.

                            reason number 4,583,234 i don't use mac, but thanks for the heads up.
                            • 12. Re: What the heck is wrong with AS 3.0?
                              C-Rock Level 2
                              David,

                              thanks for the heads up, i'll check it in the morning, i bet it is the children that are causing the problem. seems like the text is also causing a problem. text is static and the background is a movieclip.

                              a hit area hanging over the button is a bad thing now? i know in 2.0 if you had a hit area that was too small or too close to the largest area the button would go back and forth quickly between the rollover and out states.

                              i'll let you know about the rollovers, thanks again for your help.

                              c
                              • 13. Re: What the heck is wrong with AS 3.0?
                                Level 7
                                C-Rock,

                                > a hit area hanging over the button is a bad thing now? i know
                                > in 2.0 if you had a hit area that was too small or too close to
                                > the largest area the button would go back and forth quickly
                                > between the rollover and out states.

                                It still will, if the hit area moves out from beneath the mouse. Makes
                                sense, actually, because by moving out of the way, such a button triggers
                                its own alternating event handlers. You're probably fine ... enlarged hit
                                areas are perfectly acceptable. :) I was just wondering if that might be
                                affecting your issue in this particular case.

                                > i'll let you know about the rollovers, thanks again for your
                                > help.

                                Sure thing. I wish I had a "eureka!"-ready answer for you, but maybe
                                some of your troubleshooting will bring something to light.


                                David Stiller
                                Adobe Community Expert
                                Dev blog, http://www.quip.net/blog/
                                "Luck is the residue of good design."


                                • 14. Re: What the heck is wrong with AS 3.0?
                                  C-Rock Level 2
                                  the movie clips and text in the buttons were causing the problem. if disable the mouseChildren it works correctly.

                                  thanks David!
                                  • 15. Re: What the heck is wrong with AS 3.0?
                                    Level 7
                                    C-Rock,

                                    > the movie clips and text in the buttons were causing the
                                    > problem. if disable the mouseChildren it works correctly.

                                    Woo hoo! Glad that worked for you. :)


                                    David Stiller
                                    Contributor, How to Cheat in Flash CS3
                                    http://tinyurl.com/2cp6na
                                    "Luck is the residue of good design."