用flex制作简单的mp3播放器
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://weijie.blog.51cto.com/340746/66462 |
以下是制作简单mp3播放器的核心代码。 <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="110" layout="vertical" horizontalAlign="center" verticalAlign="center" > <mx:Script> <![CDATA[ import mx.core.SoundAsset; import flash.media.*; [Embed(source="song.mp3")] [Bindable] public var Song:Class; public var mySong:SoundAsset = new Song() as SoundAsset; public var channel:SoundChannel; public function playSound():void { // 先 停止 stopSound(); // 在播放 channel = mySong.play(0,int.MAX_VALUE); } public function stopSound():void { // 停止 if ( channel != null ) channel.stop(); } ]]> </mx:Script> <mx:HBox> <mx:Button label="play" click="playSound();"/> <mx:Button label="stop" click="stopSound();"/> </mx:HBox> </mx:Application> 本文出自 “魏杰的技术专栏” 博客,请务必保留此出处http://weijie.blog.51cto.com/340746/66462 本文出自 51CTO.COM技术博客 |



weijie@java
博客统计信息
热门文章
最新评论
友情链接
