5 Replies Latest reply on Apr 18, 2009 4:09 PM by shintashi

    on Press confusion

    shintashi Level 1

      So I have a sequence of the following (40 more to be precise) and they all work fine; you click it, the mc moves up, you click it again, it moves back down. The only problem is,

       

       

      b5.onPress = function(){b5._y = 41;}
      b5.onRelease = function(){b5._y = 68;}
      b50.onPress = function(){b50._y = 41;}
      b50.onRelease = function(){b50._y = 68;}

       

      Something like this:

       

      b5.onPress = function(){b5._y = 41; b50._y = 41;} has no effect whatsoever on b50. I was also unable to do anything like

       

      b5.onPress = function(){b5._y = 41; b50._rotation = 90;} and so on. Its as if the only thing the onPress objects recognize is themselves. Is there a workaround? And what's really going on?

        • 1. Re: on Press confusion
          kglad Adobe Community Professional & MVP

          "you click it, the mc moves up, you click it again, it moves back down."

           

          that's not what your code does so if that's what you're seeing, something else is happening (in addition to or instead of that code).

          • 2. Re: on Press confusion
            shintashi Level 1

            the object in question is smaller than the 68-41 pix, which is why I used an onrelease in one command and an onpress in another. When I tried originally an onpress combined with an if(y >... y <...) nothing happened.

            • 3. Re: on Press confusion
              kglad Adobe Community Professional & MVP

              i have no idea what your last post is trying to convey.  so, you might re-state exactly what you see when you click a button.

              • 4. Re: on Press confusion
                shintashi Level 1

                i have a bead, it is about 23 pixels x 23 pixels. When it is clicked, it moves up the Y axis to it's second location.

                 

                I move the mouse over to the bead in the second location, and click, and when the mouse button is released, it moves back to position 1. The distance the bead moves prevents the onpress and onrelease hit areas from interfering with each other. I am unable, however, to influence other bead positions in the same function.

                • 5. Re: on Press confusion
                  kglad Adobe Community Professional & MVP

                  that's not what your code is specifying so you have something else going on that's not understandable from what you've posted.  the posted code would cause a button:

                   

                  when the mouse is pressed to change its _y property to 41 and when the mouse is released that button's _y property would change to 68.