[AS3]as3的运用Sound类实现播放/暂停/停止mp3音乐播放器源代码
[AS3]as3的运用Sound类实现播放/暂停/停止mp3音乐播放器源代码,as3播放器Sound类,as3音乐播放器,音乐播放器源代码
[AS3]as3的运用Sound类实现播放/暂停/停止mp3音乐播放器
- //number that is redefined when the pause button is hit
- var pausePoint:Number = 0.00;
- //a true or false value that is used to check whether the sound is currently playing
- var isPlaying:Boolean;
- //think of the soundchannel as a speaker system and the sound as an mp3 player
- var soundChannel:SoundChannel = new SoundChannel();
- var sound:Sound = new Sound(new URLRequest("CuPLayer_com/cuplayer.mp3"));
- //your stop button and play/pause buttons
- xstop.addEventListener(MouseEvent.CLICK, clickStop);
- xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);
- soundsoundChannel = sound.play();
- isPlaying = true;
- function clickPlayPause(evt:MouseEvent) {
- if (isPlaying) {
- pausePoint = soundChannel.position;
- soundChannel.stop();
- isPlaying = false;
- } else {
- soundsoundChannel = sound.play(pausePoint);
- isPlaying = true;
- }
- }
- function clickStop(evt:MouseEvent) {
- if (isPlaying) {
- soundChannel.stop();
- isPlaying = false;
- }
- pausePoint = 0.00;
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...