Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On LastEvent - HELP!

Status
Not open for further replies.

Redwine311

Technical User
Apr 4, 2003
3
US
Ok here is my question-

I have a project that I want to only play sound if the user moves/click the mouse or keyboard. If the LastEvent > 4 then
music stops. So far I can get the the sound to FadeIn on any event and it will stop if I dont touch anything for 4 secs.

The only problem is that-
1) After the sound has stopped and I move the mouse to FadeIn the sound once again, I want the sound that is playing to resume where it left off and not restart.

2) When the LastEvent is more than 4 secs I want the sound to FadeOut instead of just cutting off abruptly.

I have tried different things and seem to get errors..I dont have the file at this computer so I cannot include the script but I will if someone needs it.

Thanks for any help anyone can offer!
Red
 
When you stop the sound, store the currentTime of that sound in a varaible.
Then when you want to play it again from the last played point, use
sound(channelNum).play([#member: member(whichmember), {#startTime: milliseconds, #endTime: milliseconds, #loopCount: numberOfLoops, #loopStartTime: milliseconds, #loopEndTime: milliseconds, #preloadTime: milliseconds}])

Though you don't need to set all those properties, the #startTime itself will do just fine. You can also use the #endTIme to stop the sound after 4 secs without you having to manually keep track of the played duration.

Mayuresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top