Play a sound for a certain duration
I have a mp3 file and I would like to play it from one position and for a certain duration. I have first used the Sound class, the play method where I can specify the start but not the duration.
I have lo开发者_Go百科oked then at SoundEffect class where you can specify a duration and a startTime. However I do not know how to play it from a AS3 class not from MXML : there is a play method ... but I get no sound !! Help!
Thanks
You might be able to implement the duration logic yourself using a Timer object and then calling Stop on your Sound when the time elapses.
You could do this using KitchenSync (http://kitchensynclib.googlecode.com) which provides control over sound files and code-based timing.
Check out the KSSoundController class
精彩评论