已注销用户
								2014-05-24 12:23:20
							
							Flex开发实例教程-Mp3播放器代码demo分享
本例中的MP3播放器是用Flex做的,主要是ActionScript和MXML。主要的功能有 播放,暂停,音量控制,播放进度显示。好了先给大家看看界面吧!如下:
总体的设计还是用了PureMVC框架。项目目录:
这里简单的说说几个功能点吧!
1.播放进度
显示歌曲播放的进度可以使用Flex中 提供的ProgressBar控件,这个控件可以事实的去显示歌曲进行的任务完成的情况!代码如下:
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" height="30"> <mx:ProgressBar id="progressBar" left="10" top="10" label="" mode="manual"/> </mx:Canvas>
2.歌曲列表
在Flex 里面提供了List,DataGrid等数据控件。本例中就三个字段 我们可以选择DataGrid控件来显示歌曲列表。在该控件里面可以使用DataGridColumn来自定义列的标题,宽度,显示内容,本例中的歌曲列表代码如下:
<mx:DataGrid id="songDataGrid" dataProvider="{songs}" 
		width="200" height="150" left="10" 
		click="if (songDataGrid.selectedIndex != -1) sendEvent(SELECT)">
		<mx:columns>
			<mx:DataGridColumn dataField="songName" headerText="歌曲"/>
			<mx:DataGridColumn dataField="songArtist" headerText="歌手"/>
			<mx:DataGridColumn dataField="songDuring" headerText="时间"/>
		</mx:columns>
	</mx:DataGrid>
3.播放
播放功能是播放器程序里面最核心的应用,当我们点击播放的时候,系统会相应去调用事件函数。如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" height="30" 
	horizontalAlign="center">
	
	<mx:Script>
		<![CDATA[
			public static const PLAY:String = "play";//播放 静态变量
			
			private function controlHandle(note:String):void
			{
				dispatchEvent(new Event(note));// 派发 事件
			}
		]]>
	</mx:Script>
	
	<mx:Image id="btnPlay" source="@Embed(source='/assets/play.png')" 
		buttonMode="true" click="controlHandle(PLAY)"/>		
</mx:HBox>
暂停控制,停止控制,音量调节等我就不继续详细介绍了!
说明:有需要的牛牛们可以下载下来看看,有bug可以一起解决,因为我也是因为兴趣 学习没几天,Flex方面的大牛请勿笑喷!
由最代码官方编辑于2016-9-1 9:55:27
猜你喜欢
请下载代码后再发表评论
    
											  
													 文件名:MP3Player.rar,文件大小:12997.946K
											  
											  
												  下载
											  
											  
											  
												
										  
								- /- /MP3Player- /MP3Player/.actionScriptProperties
- /MP3Player/.flexProperties
- /MP3Player/.project
- /MP3Player/.settings- /MP3Player/.settings/org.eclipse.core.resources.prefs
 
- /MP3Player/bin-debug- /MP3Player/bin-debug/AC_OETags.js
- /MP3Player/bin-debug/assets- /MP3Player/bin-debug/assets/next.png
- /MP3Player/bin-debug/assets/pause.png
- /MP3Player/bin-debug/assets/play.png
- /MP3Player/bin-debug/assets/previous.png
- /MP3Player/bin-debug/assets/stop.png
 
 
 
 
- /MP3Player
 相关代码
相关代码
				- 最近在学flex做了计算器
- 证 Flex 轻量级的tabView控件
- 证精 Flex xml编辑器(老外写的)
- 证 Flex xml格式化以及缩进量
- 证 Flex tree项目行上加toolTip提示(两种实现方式)
- flex可自定义圆形加载进度条例子代码下载
- 证 Flex MenuBar的使用学习
- 第一次发帖,试一下分享我之前写的flex遮罩示例吧
- 原证精 flex小型消息通知框架miniNotice最代码首发
- flex开发的图片展示工具
- 证 Flex dataGrid 表头添加按钮
- Flex4.6+Struts2.x+Hibernate3.x+Spring3.X 开发用户登录简单入门实例代码,mysql数据库
 最近下载
最近下载
				
                Echo123abc     LV6
                2020年12月20日
            
            
        
                litiansoft     LV2
                2019年9月1日
            
            
        
                FWG201018     LV2
                2019年6月19日
            
            
        
                最代码酒酒     LV20
                2019年4月17日
            
            
        
                fenting     LV1
                2018年3月23日
            
            
        
                君知否     LV17
                2017年11月14日
            
            
        
                敏哥gege     LV43
                2017年8月12日
            
            
        
                ok-wap     LV19
                2016年12月22日
            
            
        
                smmvssss2016     LV1
                2016年1月26日
            
            
        
                小码农@猪猪猪     LV12
                2015年10月20日
            
            
         最近浏览
最近浏览
				
                喃喵xxxx     LV6
                2022年9月23日
            
            
        
                微信网友_5818608349630464    
                2022年2月4日
            
            
                    暂无贡献等级
            
        
                18781170695     LV6
                2020年12月29日
            
            
        
                Echo123abc     LV6
                2020年12月19日
            
            
        
                yangctz     LV25
                2020年11月17日
            
            
        
                denyihao     LV1
                2020年11月1日
            
            
        
                1643454303    
                2020年7月18日
            
            
                    暂无贡献等级
            
        
                13336135399     LV1
                2020年6月11日
            
            
        
                落夏yyyy     LV2
                2020年5月24日
            
            
        
                jiqingxings     LV4
                2020年3月10日
            
            
        




 
                 
                 
                