please help - trouble with mouseDown, mouseUp, and looklike

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

please help - trouble with mouseDown, mouseUp, and looklike

Nicholas Bennett
 
I have some odd behavior. It seems like what I am doing is reasonable and the kind of thing anyone might want to do, I am hoping someone can tell me how I am misunderstanding.
 
I want to get the effect of a sketch button via eToys scripting - to let the kids make an active and engaging button to fire a script. It should change it's image to a 'button down' version on mouseDown and restore it on mouseUp.
 
I tried the following:
a - paint a sketch
b - make a script, 'down', to 'sound croak', set it to run on mouseDown
c - make a script, 'up',  to 'sound motor', set it to run on mouseUp
That all works fine - you get the appropriate sound on the up and down events.
 
Now to extend it to make the button up/down appearance:
1 - prepare two sketches for up and down
2 - add 'sketch lookslike downSketch' to the 'down' script
3 - add 'sketch lookslike upSketch' to the 'up' script
Only the 'down' script now fires. If I turn the 'down' script to run normally then the 'up' script runs on mouseUp.
 
What am I doing wrong? How can I get the effect I am looking for?
 
regards,
Nicholas


Be the filmmaker you always wanted to be—learn how to burn a DVD with Windows®. Make your smash hit
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: please help - trouble with mouseDown, mouseUp, and looklike

Scott Wallace
On Sep 1, 2008, at 3:27 PM, Nicholas Bennett wrote:

> I have some odd behavior. It seems like what I am doing is  
> reasonable and the kind of thing anyone might want to do, I am  
> hoping someone can tell me how I am misunderstanding.
>
> I want to get the effect of a sketch button via eToys scripting - to  
> let the kids make an active and engaging button to fire a script. It  
> should change it's image to a 'button down' version on mouseDown and  
> restore it on mouseUp.
>
> I tried the following:
> a - paint a sketch
> b - make a script, 'down', to 'sound croak', set it to run on  
> mouseDown
> c - make a script, 'up',  to 'sound motor', set it to run on mouseUp
> That all works fine - you get the appropriate sound on the up and  
> down events.
>
> Now to extend it to make the button up/down appearance:
> 1 - prepare two sketches for up and down
> 2 - add 'sketch lookslike downSketch' to the 'down' script
> 3 - add 'sketch lookslike upSketch' to the 'up' script
> Only the 'down' script now fires. If I turn the 'down' script to run  
> normally then the 'up' script runs on mouseUp.
>
> What am I doing wrong? How can I get the effect I am looking for?

Hi Nicholas,

To get this to work, don't use "look like", which changes the identity  
of the morph that is fielding the mouse-down/mouse-up sequence in mid-
stream.

Instead, use assignment statements to assign appropriate values to the  
"graphic" slot of your button, using a script such as:





or





for the mouse-down processing, and a similar script to set the graphic  
as desired upon mouse-up. Try this -- you'll see that it works just as  
you'd like.


You were not doing anything "wrong"; it's just that use of "look like"  
in the midst of mouse-button processing evidently can screw up event-
dispatch for the subsequent mouse-up.   This is arguably a bug --  
which hopefully will be addressed in some future version of etoys.  
For now, fortunately, you can readily achieve the result you want by  
assigning to the graphic slot rather than using "look like."

Cheers,

   -- Scott
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland

pastedGraphic.jpg (33K) Download Attachment
pastedGraphic.jpg (38K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: please help - trouble with mouseDown, mouseUp, and looklike

Nicholas Bennett
In reply to this post by Nicholas Bennett
Scott,
 
Thanks for the help, your suggestion works perfectly for me.
 
regards,
Nicholas

> CC: [hidden email]
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Squeakland] please help - trouble with mouseDown, mouseUp, and looklike
> Date: Mon, 1 Sep 2008 18:33:58 -0700
>
> On Sep 1, 2008, at 3:27 PM, Nicholas Bennett wrote:
>
> > I have some odd behavior. It seems like what I am doing is
> > reasonable and the kind of thing anyone might want to do, I am
> > hoping someone can tell me how I am misunderstanding.
> >
> > I want to get the effect of a sketch button via eToys scripting - to
> > let the kids make an active and engaging button to fire a script. It
> > should change it's image to a 'button down' version on mouseDown and
> > restore it on mouseUp.
> >
> > I tried the following:
> > a - paint a sketch
> > b - make a script, 'down', to 'sound croak', set it to run on
> > mouseDown
> > c - make a script, 'up', to 'sound motor', set it to run on mouseUp
> > That all works fine - you get the appropriate sound on the up and
> > down events.
> >
> > Now to extend it to make the button up/down appearance:
> > 1 - prepare two sketches for up and down
> > 2 - add 'sketch lookslike downSketch' to the 'down' script
> > 3 - add 'sketch lookslike upSketch' to the 'up' script
> > Only the 'down' script now fires. If I turn the 'down' script to run
> > normally then the 'up' script runs on mouseUp.
> >
> > What am I doing wrong? How can I get the effect I am looking for?
>
>
> Hi Nicholas,
>
> To get this to work, don't use "look like", which changes the identity
> of the morph that is fielding the mouse-down/mouse-up sequence in mid-
> stream.
>
> Instead, use assignment statements to assign appropriate values to the
> "graphic" slot of your button, using a script such as:
>



Get ideas on sharing photos from people like you. Find new ways to share. Get Ideas Here!
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland