📄 simpleplayer.mxml
字号:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="22" height="22" backgroundColor="#FFFFFF" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.rpc.events.AbstractEvent;
import model.*;
[Embed("simple_assets/start.png")]
public var _skin_play_over:Class;
[Embed("simple_assets/start.png")]
public var _skin_play_down:Class;
[Embed("simple_assets/start.png")]
public var _skin_play_up:Class;
[Embed("simple_assets/start.png")]
public var _skin_play_disable:Class;
[Embed("simple_assets/stop.png")]
public var _skin_pause_over:Class;
[Embed("simple_assets/stop.png")]
public var _skin_pause_down:Class;
[Embed("simple_assets/stop.png")]
public var _skin_pause_up:Class;
[Embed("simple_assets/stop.png")]
public var _skin_pause_disable:Class;
[Embed("simple_assets/load.gif")]
public var _skin_load_generic:Class;
private var player:PlayerModel = null;
private function init():void{
this.btn_play.setStyle('upSkin',_skin_play_up);
this.btn_play.setStyle('downSkin',_skin_play_down);
this.btn_play.setStyle('overSkin',_skin_play_over);
this.btn_play.addEventListener(MouseEvent.CLICK,this._play);
player = new PlayerModel();
var list:PlayList = new PlayList();
list.listID = 'testid';
list.listTitle = 'test playlist';
list.loaded = false;
this.player.appendPlayList(list);
var s:Song = new Song();
s.sid = 100;
s.title = 'song name';
s.author = 'song artist';
s.uid = 100;
s.url = Application.application.parameters.songUrl;
trace(s.url);
//s.url = 'http://music.youyou.com/file/jeff/%d4%f8%be%ad.mp3';
s.coverUrl = 'http://image.youyou.com/uppic/album/def.gif';
s.update = '2007-01-01';
this.player.appendSong(s);
player.addEventListener(PlayerEvent.MediaOpen,this._mediaOpen);
player.addEventListener(PlayerEvent.Stop,this._stopEvent);
}
private function _mediaOpen(evt:PlayerEvent):void{
this.btn_play.setStyle('upSkin',_skin_pause_up);
this.btn_play.setStyle('downSkin',_skin_pause_down);
this.btn_play.setStyle('overSkin',_skin_pause_over);
this.btn_play.removeEventListener(MouseEvent.CLICK,this._play);
this.btn_play.addEventListener(MouseEvent.CLICK,this._stop);
}
private function _stopEvent(evt:PlayerEvent):void{
this.btn_play.setStyle('upSkin',_skin_play_up);
this.btn_play.setStyle('downSkin',_skin_play_down);
this.btn_play.setStyle('overSkin',_skin_play_over);
this.btn_play.removeEventListener(MouseEvent.CLICK,this._stop);
this.btn_play.addEventListener(MouseEvent.CLICK,this._play);
}
private function _play(evt:MouseEvent):void{
this.btn_play.setStyle('upSkin',_skin_load_generic);
this.btn_play.setStyle('downSkin',_skin_load_generic);
this.btn_play.setStyle('overSkin',_skin_load_generic);
this.btn_play.removeEventListener(MouseEvent.CLICK,this._play);
this.btn_play.addEventListener(MouseEvent.CLICK,this._stop);
player.play();
}
private function _stop(evt:MouseEvent):void{
player.stop();
}
]]>
</mx:Script>
<mx:Button id="btn_play" x="0" y="0" width="22" height="22" borderColor="#400080"/>
</mx:Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -