It might be this:
Quote: "
if upkey()=1 then loop object 1,0,50
"
try instead:
if upkey()=1
if object playing(1) = 0
loop object 1, 0, 50
endif
endif
What's happening (I think) is that you're giving your object several hundred "start playing at frame zero" commands every second. Humans aren't fast enough to press a single keystroke, in the eyes of the computer. To verify this, try:
intCounter = 0
do
if upkey() = 1 then intCounter = intCounter + 1
set cursor 0,0
print intCounter
sync
loop
If you can hit the upkey and release it fast enough to show a counter value of "1" on the screen, then you're superhuman!
There's a concept in digital electronics called "debouncing". It applies to mechanical switches. The metallic surface of the switch, at a microscopic level, has imperfections so that when you close the switch, it "bounces" and sends a slew of on/off "signals" as the connection opens and closes.
A simple circuit known as a "debouncer" is put in place to prevent this -- the very first time the switch is closed, the debouncing logic notes the fact and doesn't allow any more "on/off" signals to pass through.
And that's pretty much what you need to do when you're checking for a keypress to start or stop an event, like your object playing.