At 4:04 PM -0600 8/31/00, neil wrote:
>Mark...
>That's what I have always done as well. Only now it doesn't wanna work.
>Here is the exact code I used for my explanation earlier.
>
>property x
>
>on beginSprite me
>   x = 0
>end
>
>on mouseDown me
>   x = 1
>end
>
>on mouseUp me
>   if x then
>    alert "I'm button 1"
>    x = 0
>   end if
>end
>
>I just copied the above into a separate behavior and changed the 
>alert to say "I'm button 2" so I had 2 different behaviors. I have 
>been building buttons (amongst other things ;) for quite a while now 
>and I can't recall ever running into this before.
>

Hey Neil,

Mark's technique of using a flag property variable to keep track of 
which sprite was clicked down on, is the typical solution to this.  I 
think the mistake in your code is that you do not have an "on 
mouseUpOutside" handler - which in his code turns off the flag.

Think of it this way.  If you click down on button 1 in your 
scenario, the first sprite's version of "x" gets set to 1.  Then 
while the mouse is down, you move it over button 2 and let up on the 
mouse button.  The value of "x" in the button 1 sprite doesn't get 
reset.  I think this is the cause of the problem.

For a full discussion of how to code a standard button, check out my 
article on DOUG at:

   http://www.director-online.com/accessArticle2.cfm?id=340

Irv
-- 
Lingo / Director / Shockwave development for all occasions
            (We even do weddings and Bar Mitzvahs!)
   See our kid's CD-Rom's at:  http://www.furrypants.com

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to