Mouse trap

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dalkin
Posts: 176
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Mouse trap

Post by dalkin » Fri Feb 05, 2021 5:22 am

Howdy .. can anyone confirm that mouseOver can't be used to play a sound (.aif) that has been imported to the stack?

MouseDown works a treat but I'm trying to create an environment where a user can mouse over buttons that are coded to play a sound without having to click. MouseOver is silent in this regard.
If we're treading on thin ice, well you might as well dance.

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Mouse trap

Post by kdjanz » Fri Feb 05, 2021 5:26 am

Maybe you could try mouseWithin?

dalkin
Posts: 176
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Re: Mouse trap

Post by dalkin » Fri Feb 05, 2021 6:10 am

Thanks for that .. playWithin actually works but it sets up a repeat loop that triggers the sound in a very fast loop, too fast for a user to control if several sounds are to be played. However (my edit) mouseEnter works just like I want so many thanks for the tip!!
If we're treading on thin ice, well you might as well dance.

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Mouse trap

Post by kdjanz » Fri Feb 05, 2021 6:17 am

Set a flag variable so that it plays once, then ignores the ‘play’ message. Use the idle message or mouseMove message to refresh the flag so that when they go within later, they will get the sound played once more.

Was the mouseOver message coming from being over a button or a graphic? What object was the ‘over’ referring to?

Glad mouseEnter works for what you need. That’s cleaner than the flag variable.

dalkin
Posts: 176
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Re: Mouse trap

Post by dalkin » Fri Feb 05, 2021 6:22 am

Coming from a button. Great advice, I'll try tonight.
If we're treading on thin ice, well you might as well dance.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Mouse trap

Post by Klaus » Fri Feb 05, 2021 10:31 am

There is no "mouseover" message in LC!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Mouse trap

Post by dunbarx » Fri Feb 05, 2021 3:57 pm

I didn't even have to look up "mouseOver". No such animal.

How about "mouseEnter"? One time use per, er, entry. Not sure how wildly the user will move the cursor around the screen, though.

Craig

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Mouse trap

Post by kdjanz » Sat Feb 06, 2021 12:31 am

It was late at night is my only defense!

He got the idea anyway.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”