can I make Flash/swf "movie" in which I can scroll back and forth through the sound recording?
so suppose I have a long sound recording as part of a Flash presentation. Can I put on the presentation a scrollbar and start/stop/pause/resume buttons as in Media Player or Windows sound recorder that would allow me to scroll to basically jump to any moment in the sound recording? So I guess, I am asking, can such typical sound player functionality 开发者_StackOverflow社区be implemented for a Flash presentation in Flash?
If there are sample apps that already demonstrate how to write similar code, links are very much appreciated :-)
Yes, it is possible to jump to any position within a loaded soundfile. Using the Sound class, you can get the length of the sound file by using Sound.length
and the current position of the playing sound with SoundChannel
. That way, you can construct a scroller that updates its position when the sound is playing and that allows to jump to any different position.
If a user jumps to a position, you then only need to get the start time and use it as a parameter of Sound.play()
. That method also returns the SoundChannel
object you need for the current position. Just remember to stop the playback first before playing a file again.
精彩评论