用flex写的一个mp3播放器

      :: Flash :: 2005-7-17 22:13


Flex好像不支持as2.0的语法~~~
代码如下:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" width="360" height="280" styleName="text" marginTop="4" marginBottom="0" marginLeft="0" marginRight="0">
<mx:Style>
.DataGridColumn {
font-family: Verdana;
font-size: 16;
}
.text{
font-family: Verdana;
font-size: 12;
color:#006699;
}
</mx:Style>
<mx:Script>
<![CDATA[
var myid=0;
function playMp3(myid){
mp3Menu.selectedIndex=myid;
myPlay.contentPath=mp3Menu.selectedItem.url;
myPlay.load();
}

function nextSong(){
myid++;
if(myid==mp3Menu.length-1){
myid=0;
}
playMp3(myid);
}
function swapList() {
if(showList.label == "show list") {
showList.label = "hide list";
mp3Menu.visible = true;
} else {
showList.label = "show list";
mp3Menu.visible = false;
}
}
function setting(){
playMp3(myid);
}
]]>
</mx:Script>
<mx:Model id="playlist">
<song url="http://new.schoolmusic.net/non-cgi/usr/1/1_3483_4.mp3" title="许巍-喝茶去"></song>
<song url="http://download.schoolmusic.net/mp3/7080/10.mp3" title="月舞"></song>
<song url="http://5any.bdxq.net/bbs/朴树-且听风吟.mp3" title="且听风吟"></song>
</mx:Model>
<mx:VBox id="mainBody" label="ty">
<mx:MediaPlayback fps = "100" id="myPlay" width="340" height="80" complete="nextSong()" autoPlay="true" controllerPolicy="on"/>
<mx:Button id="showList" label="show list" click="swapList()"/>
<mx:DataGrid id="mp3Menu" dataProvider="{playlist.song}" rollOverColor="#CDFFC1" selectionColor="#CDFFC1" visible="false" width="340" showHeaders="false" change="playMp3(mp3Menu.selectedIndex)" initialize="setting()">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="title"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:Application>
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}