12 Replies Latest reply on Jun 16, 2009 4:38 PM by Zealouse

    Major bug Flash "OnPress" !


      Repeatedly tapping on a buttons will result in the buttons staying in a "onPress" state repeatedly executing the onpress function!


      This is extremely repeatable on a touch screen monitor! and can be duplicated with a mouse.


      I am not sure if it’s a "draggout"/"onpress" issue or if Flash is missing the message from windows that a release has taken place.



      This issue will happen no matter how you create the onpress function, you can create a button object, add action to a movie clip doesn’t matter, at some point the object will get stuck in a onpress state, meaning if you have a onpress action it will continue to fire off even thou windows has clearly told flash there has been a onrelease or ondraggout.


      I have tested this on 4 touchscreens and 2 monitors with mouse and/or touch screen.


      Is there any way around this bug?

        • 1. Re: Major bug Flash "OnPress" !
          RossRitchey Level 4

          I've never come across this "bug" before myself.


          A possible workaround, don't use onPress use onRelease.  Or you could try something out with onMouseDown and onMouseUp

          1 person found this helpful
          • 2. Re: Major bug Flash "OnPress" !
            Rothrock Level 5

            I've been around these forums for a long time and never heard of this either.


            I am very suspicious of your comment, "This issue will happen no matter how you create the onpress function."


            I just made a button and no matter how fast or often I click it doesn't stay in the down state. But then again I don't have any specific code on it.


            I'm guessing that your code has something that is wrong with it -- or if not "wrong" per se just the source of the issue. There is most likely something in your specific artwork/code that is causing the issue.


            We need more information to provide any real help.


            Oh, I just thought of my one pet issue. Have you assigned a releaseOutside event handler? it should be the same as your release handler. If you have overlooked releaseOutside that could easily be the problem.

            1 person found this helpful
            • 3. Re: Major bug Flash "OnPress" !
              Zealouse Level 1

              Thank you for the suggestion of "onMouseDown and onMouseUp" I will try this and report back.

              I will make a short video of it happening so you can see.


              I dont have any other code at all.


              These are the steps I take:


              1. Create new project AS2

              2. Draw out a vector shape

              3.Right click on vector and turn it to a MovieClip

              4. Name it "bnt_1"

              5. Do 2-4 for button 2

              5. Publish swf or exe

              5.Open swf/exe

              6.Tap between button 1 and 2

              7. one of the buttons will stick in the "onpress" state


              I will sit there and tap between the two buttons for a minute and it will happen randomly.


              I dont have any other code but the button fuctions.


              bnt_1.onRollOut = function() {
              statuse.text = "onRollOut";
              bnt_1.onDragOver = function() {
              statuse.text = "onDragOver";
              bnt_1.onDragOut = function() {
              statuse.text = "onDragOut";
              bnt_1.onRelease = function() {
              statuse.text = "onRelease";
              bnt_1.onRollOver = function() {
              statuse.text = "onRollOver";
              bnt_1.onPress = function() {
              statuse.text = "onPress";

              bnt_2.onRollOut = function() {
              statuse2.text = "onRollOut";
              bnt_2.onDragOver = function() {
              statuse2.text = "onDragOver";
              bnt_2.onDragOut = function() {
              statuse2.text = "onDragOut";
              bnt_2.onRelease = function() {
              statuse2.text = "onRelease";
              bnt_2.onRollOver = function() {
              statuse2.text = "onRollOver";
              bnt_2.onPress = function() {
              statuse2.text = "onPress";

              • 4. Re: Major bug Flash "OnPress" !
                Zealouse Level 1

                Thank you for the suggestions,


                Yeah I have ever possible button event handler and no other code.


                In the normal world I bet people are not seeing this issue or if it happens it wouldn't matter BUT I program for 50 ton machines and use Flash to control these machines...so you could imagine if someone press the button a few times and it sticks! and a machine traveling at 200 inches per minute could become an issue.

                I also program for touch screen programs using flash and this seems to be an issue in that market as well.


                I'll post the flv and a video of it happening and also include mouse event handler.

                • 5. Re: Major bug Flash "OnPress" !
                  Rothrock Level 5

                  I think you've left out a couple steps there -- where does frame 3 come from? And if these are movieclips they will be playing so where is the code to stop them initially. And where is statuse coming from? But I do get the idea...but


                  I still can't reproduce this at all. By publishing and then opening the swf are you saying that you don't get this with test publishes only when opening the file outside of the testing environment?


                  And by "... tap between the two buttons ...." do you mean click one and then the other or do you mean to actually tap in the space between the buttons. I'm pretty sure you mean the first, but since I can't reproduce it I'm looking for any reason that I'm not following your instructions.


                  Also is this leisurely back and forth clicking or is this crazy out of control clicking? I've tried both.


                  By having the onDragOut I don't think you need to have the onReleaseOutside, but it wouldn't hurt to put it in. And I don't think you need the onDragOver, unless later you are going to be dragging things over it. And not that you asked, but here is a way to maybe clean up your code and make it a little more manageable.






                  function rolledOut(){





                  function draggedOut(){





                  And if you have more than 2 buttons you could even do a loop:


                  for(var i=0;i<numButtons;i++){

                  var curButton:MovieClip=this["btn_"+i]






                  And the reason that I say that it would help clean up your code is that I just noticed something. You cut and pasted your code and then you changed all the refernces from bnt_1 to bnt_2. Right?


                  Check the code for bnt_2.onDragOver!

                  • 6. Re: Major bug Flash "OnPress" !
                    Zealouse Level 1

                    Hi Rothrock,


                    Thank you for the suggestions.


                    I wanted to send each result of each state of each button to the status text and wanted to write the code as simple as possible.

                    I did write it like you suggested which is how I normally write code but the results are the same.


                    I have to use "dragout" and "onReleaseOutside" with a touch screen because it easy to drag in and out of things, I also want to see everything Flash is receiving from Windows.


                    I also write in C++ and VB.net and have created buttons to test and have NOT had any issues!


                    Here is the video: (it was hard to read the text so I had to move the camera around also I point out with all touch screens you can send a "onpress" to windows and move the windows curse with another finger to another location).


                    The results when the button gets stuck onPress are:


                    Mouse: Moving

                    Bnt1: OnPress

                    Bnt2: OnRollOut




                    Here is the source fla I was using to test I am using CS4 but saved the file as CS3:



                    I am thinking of making a mouse listener and hit test code rather than using Flash's button event handler.

                    I like the look of this class and will see if the mouse is moving to undo a onpress



                    Not sure what do you think?


                    Also I would like to point out that it is silly this forum doesn’t have a "code" insert button to indent pasted code

                    • 7. Re: Major bug Flash "OnPress" !
                      Rothrock Level 5

                      Well I don't have a touch screen so I'm only doing this with a mouse and I can't cause it to happen. You said this would happen with the mouse as well? I really can't make it do it. I really think it has to do with the touch screen.


                      Also I don't see any onReleaseOutside event handler in your sample. Since you aren't putting that into the textfields your onPress-onRollOut statuses may or may not be the actual event sequence. I'd be happy to test if that makes a difference, but I just can't make it happen.


                      Here are some other things I might recommend trying. First I would take the stop() off of each frame in the button and just use some code to stop them from playing. Don't really think it is the problem but I'm grasping at straws.


                      There is also a little trick where you don't have to actually use gotoAndStop() to send the playhead to a specific frame. Label your frames






                      And then just apply your event handlers like normal -- except don't include any playhead code. Flash will handle the rest automagically.


                      I'm sorry, but other than that I really don't have any other ideas.

                      • 8. Re: Major bug Flash "OnPress" !
                        Zealouse Level 1

                        Hi Rothrock,


                        Thanks a great tip:

                        Label your frames






                        Good point I will add in onReleaseOutside and make those suggested changes.

                        I'll see how I got it to happen with the mouse so I can show it in a video...I think I had the two buttons close to each other so I could click them more quickley.


                        Thank you Rothrock for taking  the time to test this for me.
                        If I can pinpoint it I'll post it here otherwise I will post the work around if anyone else runs in to this issue.

                        I know for sure it isn't the touchscreen harware but it could be a issue with the way they work and report back to windows that is messing up flash.

                        • 9. Re: Major bug Flash "OnPress" !
                          Rothrock Level 5

                          Yeah I tried moving the buttons very close and over lapping them and several different little tricks to get it to happen. Sorry I can't reproduce it.


                          And yes I certainly aren't questioning the touchpad itself, I do mean there is something about how it "emulates" a mouse and reports the data back to flash and/or flashes ability to understand that data stream. Over the years I have heard various little bits here and there about troubles with touch screens. Never anything as well reasoned out and tested as what you are doing. So I haven't really learned much about it yet.


                          Please do post back if you figure anything out. I really would be interested in knowing.


                          Oh and I am a total whore for points so if you wouldn't mind marking one of my posts "helpful" that would be swell.

                          • 10. Re: Major bug Flash "OnPress" !
                            Zealouse Level 1

                            Hi Rothrock, I apologize to you and other people that have answered question that I have asked over the years I should have read the forum rules or something...I know about the correct answer but hadn't a clue about help points! I went back to all my old post and gave out the help points I should have done before.

                            Glad you said something.

                            • 11. Re: Major bug Flash "OnPress" !
                              Rothrock Level 5

                              Hey no problem. The points are a new thing with the new forums -- what maybe a month now? And nobody is under any requirement to award them. But like I said, I'm such a whore for them.


                              Thanks and good luck.

                              • 12. Re: Major bug Flash "OnPress" !
                                Zealouse Level 1

                                Ok it has been a week of testing and these are the results:


                                I wrote a C++ mouse detection of a mouse left click.

                                When the button sticks in Flash windows IS receiving the LEFT click event...


                                SO two things can be happening here:


                                1. Issue with Magic touch (Keytec) software/hardware

                                2. Message traffic/buffer error


                                I would recommend that if you have an application that requires dependable touch screen response to use a Capacitive touch screen.

                                All the big companies do!


                                I still cannot determine yet if Flash is causing a buffer/message error to the windows mouse handler and if this is even possible.... so I would say currently it is a %90 touch screen issue.



                                A resistive touch screen panel is composed of several layers, the most important of which are two thin, metallic, electrically conductive layers separated by a narrow gap. When an object, such as a finger, presses down on a point on the panel's outer surface the two metallic layers become connected at that point: the panel then behaves as a pair of voltage dividers with connected outputs. This causes a change in the electrical current which is registered as a touch event and sent to the controller for processing.


                                A capacitive touch screen panel is a sensor typically made of glass coated with a material such as indium tin oxide.[2][3] This type of sensor is basically a capacitor in which the plates are the overlapping areas between the horizontal and vertical axes in a grid pattern. Since the human body also conducts electricity, a touch on the surface of the sensor will affect the electric field and create a measurable change in the capacitance of the device. These sensors work on proximity, and do not have to be directly touched to be triggered. It is a durable technology that is used in a wide range of applications including point-of-sale systems, industrial controls, and public information kiosks. It has a higher clarity than Resistive technology, but it only responds to finger contact and will not work with a gloved hand or pen stylus unless the stylus is conductive. Capacitive touch screens can also support Multitouch. Examples include Apple Inc.'s iPhone and iPod touch, HTC's G1 & HTC Magic , Palm Inc.'s Palm Pre and Palm Eos and more recently the LG KM900 Arena, Microsoft's Zune HD, Sony Walkman X series and Sony Ericsson's Aino.