Vous êtes ici: Accueil » Sommaire Flash » Sommaire des composants Flash » Player MP3
Table des matières
Player MP3
Ce n’est pas vraiment un composant, il s’utilise avec des paramètres passés en FlashVars.
Voici un aperçu non fonctionnel :
Pour une démonstration, vous pouvez voir cette page.
Télécharger : player_mp3.swf version 0.6 (4ko)
Exemple
Voici un exemple de code HTML pour faire marcher le lecteur :
<object type="application/x-shockwave-flash" data="player_mp3.swf?mp3=test.mp3" width="200" height="20"> <param name="movie" value="player_mp3.swf?mp3=test.mp3" /> <param name="wmode" value="transparent" /> </object>
Propriétés
Nom | Description |
---|---|
mp3 | L’URL du mp3 à charger |
autoplay | 1 pour lire automatiquement |
loop | 1 pour boucler |
skin | L’URL du fichier JPEG (non progressif) à charger, dimension 200×20 |
showstop | 1 pour afficher le bouton STOP |
showinfo | 1 pour afficher le bouton INFO |
loadingcolor | La couleur de la barre de chargement |
bgcolor1 | La première couleur du dégradé du fond |
bgcolor2 | La seconde couleur du dégradé du fond |
buttoncolor | La couleur des boutons |
buttonovercolor | La couleur des boutons au survol |
slidercolor1 | La première couleur du dégradé de la barre |
slidercolor2 | La seconde couleur du dégradé de la barre |
sliderovercolor | La couleur de la barre au survol |
textcolor | La couleur du texte |
bgcolor | La couleur de fond |
Source
Le SWF a été compilé avec http://mtasc.org/ avec un -header 200:20:24
.
/** * Lecteur mp3 * @author neolao <neo@neolao.com> * @version 0.6 (22/02/2006) * @link http://resources.neolao.com/flash/components/player_mp3 * @license http://creativecommons.org/licenses/by-sa/2.5/ */ class PlayerMP3 { // ----------------------------- CONSTANTES -------------------------------- // ----------------------------- VARIABLES --------------------------------- private var _target:MovieClip; private var _backgroundInstance:MovieClip; private var _playButtonInstance:MovieClip; private var _pauseButtonInstance:MovieClip; private var _stopButtonInstance:MovieClip; private var _infoButtonInstance:MovieClip; private var _infoPanel:MovieClip; private var _separatorsInstance:MovieClip; private var _sliderInstance:MovieClip; private var _buttonList:Array; private var _sound:Sound; private var _firstPlay:Boolean = false; private var _position:Number = 0; private var _url:String = ""; private var _loop:Boolean = false; private var _autoplay:Boolean = false; private var _volume:Number = 100; private var _width:Number = 200; private var _height:Number = 20; private var _backgroundSkin:String; private var _backgroundColor:Number; private var _backgroundColor1:Number = 0x7c7c7c; private var _backgroundColor2:Number = 0x000000; private var _buttonColor:Number = 0xffffff; private var _buttonOverColor:Number = 0xffff00; private var _sliderColor1:Number = 0xcccccc; private var _sliderColor2:Number = 0x888888; private var _sliderOverColor:Number = 0xeeee00; private var _textColor:Number = 0xffffff; private var _loadingColor:Number = 0xffff00; private var _showStop:Boolean = false; private var _showInfo:Boolean = false; public var buttonWidth:Number = 26; public var sliderWidth:Number = 20; public var sliderHeight:Number = 10; /*============================= CONSTRUCTEUR =============================*/ /*========================================================================*/ /** * Constructeur * @param pTarget La cible du lecteur, là où il sera dessiné * @param pInit (optional) L'objet qui contient les paramètres d'initialisation */ public function PlayerMP3(pTarget:MovieClip, pInit:Object){ _target = pTarget; if(pInit != undefined){ this._initVars(pInit); } this._initBackground(); this._createSeparators(); this._initPlayButton(); this._initPauseButton(); this._initStopButton(); this._initInfoButton(); this._initSlider(); this._initInfoPanel(); this._initSound(); if(this._autoplay) this.play(); else this.stop(); } /** * Lancé par mtasc */ static function main(){ var vInitObject:Object = new Object(); if(_root.bgcolor != undefined){ vInitObject.backgroundColor = parseInt(_root.bgcolor, 16); } if(_root.bgcolor1 != undefined){ vInitObject.backgroundColor1 = parseInt(_root.bgcolor1, 16); } if(_root.bgcolor2 != undefined){ vInitObject.backgroundColor2 = parseInt(_root.bgcolor2, 16); } if(_root.buttoncolor != undefined){ vInitObject.buttonColor = parseInt(_root.buttoncolor, 16); } if(_root.buttonovercolor != undefined){ vInitObject.buttonOverColor = parseInt(_root.buttonovercolor, 16); } if(_root.slidercolor1 != undefined){ vInitObject.sliderColor1 = parseInt(_root.slidercolor1, 16); } if(_root.slidercolor2 != undefined){ vInitObject.sliderColor2 = parseInt(_root.slidercolor2, 16); } if(_root.sliderovercolor != undefined){ vInitObject.sliderOverColor = parseInt(_root.sliderovercolor, 16); } if(_root.textcolor != undefined){ vInitObject.textColor = parseInt(_root.textcolor, 16); } if(_root.loadingcolor != undefined){ vInitObject.loadingColor = parseInt(_root.loadingcolor, 16); } if(_root.showstop != undefined){ vInitObject.showStop = true; } if(_root.showinfo != undefined){ vInitObject.showInfo = true; } if(_root.mp3 != undefined){ vInitObject.url = _root.mp3; } if(_root.loop != undefined){ vInitObject.loop = true; } if(_root.autoplay != undefined){ vInitObject.autoplay = true; } if(_root.volume != undefined){ vInitObject.volume = Number(_root.volume); } if(_root.skin != undefined){ vInitObject.backgroundSkin = _root.skin; } var player:PlayerMP3 = new PlayerMP3(_root, vInitObject); } /*======================= FIN = CONSTRUCTEUR = FIN =======================*/ /*========================================================================*/ /*=========================== METHODES PRIVEES ===========================*/ /*========================================================================*/ /** * Initialisation des variables avec un objet * @param pInit L'objet qui contient les paramètres d'initialisation */ private function _initVars(pInit:Object){ if(pInit.backgroundColor != undefined){ this._backgroundColor = pInit.backgroundColor; } if(pInit.backgroundColor1 != undefined){ this._backgroundColor1 = pInit.backgroundColor1; } if(pInit.backgroundColor2 != undefined){ this._backgroundColor2 = pInit.backgroundColor2; } if(pInit.buttonColor != undefined){ this._buttonColor = pInit.buttonColor; } if(pInit.buttonOverColor != undefined){ this._buttonOverColor = pInit.buttonOverColor; } if(pInit.sliderColor1 != undefined){ this._sliderColor1 = pInit.sliderColor1; } if(pInit.sliderColor2 != undefined){ this._sliderColor2 = pInit.sliderColor2; } if(pInit.sliderOverColor != undefined){ this._sliderOverColor = pInit.sliderOverColor; } if(pInit.textColor != undefined){ this._textColor = pInit.textColor; } if(pInit.loadingColor != undefined){ this._loadingColor = pInit.loadingColor; } if(pInit.showStop != undefined){ this._showStop = pInit.showStop; } if(pInit.showInfo != undefined){ this._showInfo = pInit.showInfo; } if(pInit.url != undefined){ this._url = pInit.url; } if(pInit.loop != undefined){ this._loop = pInit.loop; } if(pInit.autoplay != undefined){ this._autoplay = pInit.autoplay ; } if(pInit.volume != undefined){ this._volume = pInit.volume; } if(pInit.backgroundSkin != undefined){ this._backgroundSkin = pInit.backgroundSkin; } } /** * Initialisation du fond */ private function _initBackground(){ if(this._backgroundInstance == undefined){ this._backgroundInstance = this._target.createEmptyMovieClip("background_mc", this._target.getNextHighestDepth()); } this._backgroundInstance.clear(); // Le fond if(this._backgroundColor != undefined){ this._backgroundInstance.beginFill(this._backgroundColor); this._backgroundInstance.lineTo(0, this._height); this._backgroundInstance.lineTo(this._width, this._height); this._backgroundInstance.lineTo(this._width, 0); this._backgroundInstance.endFill(); } // Le skin if(this._backgroundSkin != undefined){ // Une image de skin a été définie var vSkin:MovieClip = this._backgroundInstance.createEmptyMovieClip("skin_mc", this._backgroundInstance.getNextHighestDepth()); vSkin.loadMovie(this._backgroundSkin); }else{ // Aucune image de skin n'a été définie this._backgroundInstance.skin_mc.removeMovieClip(); this._backgroundInstance.beginGradientFill("linear", [this._backgroundColor1, this._backgroundColor2], [100,100], [0,255], {matrixType:"box", x:0, y:0, w:this._width, h:this._height, r:Math.PI/2}); this._backgroundInstance.moveTo(0, 5); this._backgroundInstance.lineTo(0, this._height - 5); this._backgroundInstance.curveTo(0, this._height, 5, this._height); this._backgroundInstance.lineTo(this._width - 5, this._height); this._backgroundInstance.curveTo(this._width, this._height, this._width, this._height - 5); this._backgroundInstance.lineTo(this._width, 5); this._backgroundInstance.curveTo(this._width, 0, this._width - 5, 0); this._backgroundInstance.lineTo(5, 0); this._backgroundInstance.curveTo(0, 0, 0, 5); this._backgroundInstance.endFill(); } } /** * Crée les séparateurs de bouton */ private function _createSeparators(){ if(this._separatorsInstance == undefined){ this._separatorsInstance = this._target.createEmptyMovieClip("separators_mc", this._target.getNextHighestDepth()); } var vTotal:Number = 1; // Premier séparateur est obligatoire if(this._showStop) vTotal++; if(this._showInfo) vTotal++; this._separatorsInstance.clear(); for(var i:Number=1; i<=vTotal; i++){ this._separatorsInstance.beginFill(0xcccccc, 50); this._separatorsInstance.moveTo(this.buttonWidth*i, 2); this._separatorsInstance.lineTo(this.buttonWidth*i, this._height - 2); this._separatorsInstance.lineTo(this.buttonWidth*i + 1, this._height - 2); this._separatorsInstance.lineTo(this.buttonWidth*i + 1, 2); this._separatorsInstance.endFill(); this._separatorsInstance.beginFill(0x666666, 50); this._separatorsInstance.lineTo(this.buttonWidth*i - 1, 2); this._separatorsInstance.lineTo(this.buttonWidth*i - 1, this._height - 2); this._separatorsInstance.lineTo(this.buttonWidth*i, this._height - 2); this._separatorsInstance.endFill(); } } /** * Initialisation d'un bouton * @param pTarget Le bouton à initialiser */ private function _initButton(pTarget){ var vArea:MovieClip = pTarget.createEmptyMovieClip("area_mc", pTarget.getNextHighestDepth()); var vIcon:MovieClip = pTarget.createEmptyMovieClip("icon_mc", pTarget.getNextHighestDepth()); vArea.beginFill(0, 0); vArea.moveTo(2, 2); vArea.lineTo(2, this._height - 4); vArea.lineTo(this.buttonWidth - 4, this._height - 4); vArea.lineTo(this.buttonWidth - 4, 2); vArea.endFill(); vArea.parent = this; vArea.color = new Color(vIcon); vArea.onRollOver = function(){ this.color.setRGB(this.parent._buttonOverColor); }; vArea.onRollOut = vArea.onDragOut = vArea.onPress = function(){ this.color.setRGB(this.parent._buttonColor); }; } /** * Change l'état d'un bouton * @param pButton L'instance du bouton * @param pStatus true pour activer le bouton, sinon false * @param pMask (optional) pour masquer complètement le bouton */ private function _enableButton(pButton, pStatus, pMask){ pButton.area_mc.enabled = pStatus; pButton._visible = !pMask; if(!pStatus) pButton.icon_mc._alpha = 30; else pButton.icon_mc._alpha = 100; } /** * Initialisation du bouton Play */ private function _initPlayButton(){ if(this._playButtonInstance == undefined){ this._playButtonInstance = this._target.createEmptyMovieClip("play_btn", this._target.getNextHighestDepth()); this._initButton(this._playButtonInstance); } this._playButtonInstance.area_mc.onRelease = this._delegate(this, function(){ this.play(); }); // icone this._playButtonInstance.icon_mc.beginFill(this._buttonColor); this._playButtonInstance.icon_mc.lineTo(0, 8); this._playButtonInstance.icon_mc.lineTo(5, 4); this._playButtonInstance.icon_mc.endFill(); this._playButtonInstance.icon_mc._y = this._height/2 - this._playButtonInstance.icon_mc._height/2; this._playButtonInstance.icon_mc._x = this.buttonWidth/2 - this._playButtonInstance.icon_mc._width/2; } /** * Initialisation du bouton Pause */ private function _initPauseButton(){ if(this._pauseButtonInstance == undefined){ this._pauseButtonInstance = this._target.createEmptyMovieClip("pause_btn", this._target.getNextHighestDepth()); this._initButton(this._pauseButtonInstance); } this._pauseButtonInstance.area_mc.onRelease = this._delegate(this, function(){ this.pause(); }); // icone this._pauseButtonInstance.icon_mc.beginFill(this._buttonColor); this._pauseButtonInstance.icon_mc.lineTo(0, 8); this._pauseButtonInstance.icon_mc.lineTo(3, 8); this._pauseButtonInstance.icon_mc.lineTo(3, 0); this._pauseButtonInstance.icon_mc.endFill(); this._pauseButtonInstance.icon_mc.beginFill(this._buttonColor); this._pauseButtonInstance.icon_mc.moveTo(5, 0); this._pauseButtonInstance.icon_mc.lineTo(5, 8); this._pauseButtonInstance.icon_mc.lineTo(8, 8); this._pauseButtonInstance.icon_mc.lineTo(8, 0); this._pauseButtonInstance.icon_mc.endFill(); this._pauseButtonInstance.icon_mc._y = this._height/2 - this._pauseButtonInstance.icon_mc._height/2; this._pauseButtonInstance.icon_mc._x = this.buttonWidth/2 - this._pauseButtonInstance.icon_mc._width/2; } /** * Initialisation du bouton Stop */ private function _initStopButton(){ if(this._showStop){ if(this._stopButtonInstance == undefined){ this._stopButtonInstance = this._target.createEmptyMovieClip("stop_btn", this._target.getNextHighestDepth()); this._initButton(this._stopButtonInstance); } this._stopButtonInstance._x = this.buttonWidth; this._stopButtonInstance.area_mc.onRelease = this._delegate(this, function(){ this.stop(); }); // icone this._stopButtonInstance.icon_mc.beginFill(this._buttonColor); this._stopButtonInstance.icon_mc.lineTo(0, 8); this._stopButtonInstance.icon_mc.lineTo(8, 8); this._stopButtonInstance.icon_mc.lineTo(8, 0); this._stopButtonInstance.icon_mc.endFill(); this._stopButtonInstance.icon_mc._y = this._height/2 - this._stopButtonInstance.icon_mc._height/2; this._stopButtonInstance.icon_mc._x = this.buttonWidth/2 - this._stopButtonInstance.icon_mc._width/2; } } /** * Initialisation du bouton Info */ private function _initInfoButton(){ if(this._showInfo){ if(this._infoButtonInstance == undefined){ this._infoButtonInstance = this._target.createEmptyMovieClip("info_btn", this._target.getNextHighestDepth()); this._initButton(this._infoButtonInstance); } this._infoButtonInstance._x = (this._showStop)?this.buttonWidth*2:this.buttonWidth; this._infoButtonInstance.area_mc.onRelease = this._delegate(this, function(){ this.info(); }); this._infoButtonInstance.icon_mc.lineStyle(2, this._buttonColor); this._infoButtonInstance.icon_mc.moveTo(0, 2); this._infoButtonInstance.icon_mc.curveTo(0, 0, 2, 0); this._infoButtonInstance.icon_mc.curveTo(4, 0, 4, 2); this._infoButtonInstance.icon_mc.curveTo(4, 3.5, 3, 4); this._infoButtonInstance.icon_mc.curveTo(2, 5, 2, 6); this._infoButtonInstance.icon_mc.moveTo(2, 8); this._infoButtonInstance.icon_mc.lineTo(2, 9); this._infoButtonInstance.icon_mc._y = this._height/2 - this._infoButtonInstance.icon_mc._height/2 + 2; this._infoButtonInstance.icon_mc._x = this.buttonWidth/2 - this._infoButtonInstance.icon_mc._width/2 + 2; } } /** * Initialisation du panneau d'information */ private function _initInfoPanel(){ if(this._showInfo){ if(this._infoPanel == undefined){ this._infoPanel = this._target.createEmptyMovieClip("infoPanel_mc", this._target.getNextHighestDepth()); this._infoPanel.parent = this; } // fond this._infoPanel.beginGradientFill("linear", [this._backgroundColor1, this._backgroundColor2], [100,100], [0,255], {matrixType:"box", x:0, y:0, w:this._width, h:this._height, r:Math.PI/2}); this._infoPanel.moveTo(0, 5); this._infoPanel.lineTo(0, this._height - 5); this._infoPanel.curveTo(0, this._height, 5, this._height); this._infoPanel.lineTo(this._width - 5, this._height); this._infoPanel.curveTo(this._width, this._height, this._width, this._height - 5); this._infoPanel.lineTo(this._width, 5); this._infoPanel.curveTo(this._width, 0, this._width - 5, 0); this._infoPanel.lineTo(5, 0); this._infoPanel.curveTo(0, 0, 0, 5); this._infoPanel.endFill(); this._infoPanel.createTextField("time_txt", 1, 2, 0, 70, this._height); this._infoPanel.createTextField("info_txt", 2, 72, 0, this._width - 74, this._height); var infoStyle:TextFormat = new TextFormat(); infoStyle.color = this._textColor; infoStyle.font = "_sans"; infoStyle.align = "left"; this._infoPanel.time_txt.selectable = false; this._infoPanel.time_txt.setNewTextFormat(infoStyle); this._infoPanel.info_txt.selectable = false; this._infoPanel.info_txt.setNewTextFormat(infoStyle); this._infoPanel._visible = false; this._infoPanel.onRelease = function(){ delete this.onEnterFrame; this._visible = false; }; this._infoPanel.waitScroll = this._infoPanel.scrollMemo = 0; this._infoPanel.update = function(){ var sep:String = ""; this._visible = true; this.time_txt.text = ""; this.info_txt.text = ""; if(this.parent._sound.duration != undefined){ this.time_txt.text = this.parent._milli2time(this.parent._sound.position) + "/" + this.parent._milli2time(this.parent._sound.duration); }else{ this.time_txt.text = "Non chargé"; } if(this.parent._sound.id3.artist != undefined){ this.info_txt.text += sep + this.parent._sound.id3.artist; sep = " - "; } if(this.parent._sound.id3.songname != undefined){ this.info_txt.text += sep + this.parent._sound.id3.songname; } if(this.info_txt.text == ""){ this.info_txt.text += "Inconnu"; } // Défilement if(this.scrollMemo == this.info_txt.hscroll && ++this.waitScroll > 30){ this.info_txt.hscroll = this.scrollMemo += 1; } if(this.scrollMemo != this.info_txt.hscroll && --this.waitScroll >= 0){ if(this.waitScroll <= 0){ this.info_txt.hscroll = this.scrollMemo = 0; this.waitScroll = 0; } } }; } } /** * Initialisation de la barre */ private function _initSlider(){ if(this._sliderInstance == undefined){ this._sliderInstance = this._target.createEmptyMovieClip("slider_mc", this._target.getNextHighestDepth()); } // calcul de la taille var vMargin:Number = this.buttonWidth; if(this._showStop) vMargin += this.buttonWidth; if(this._showInfo) vMargin += this.buttonWidth; vMargin += 10; this._sliderInstance._x = vMargin; this._sliderInstance.width = this._width - vMargin - 10; // barre this._sliderInstance.barBg_mc.removeMovieClip(); var vBarBg:MovieClip = this._sliderInstance.createEmptyMovieClip("barBg_mc", this._sliderInstance.getNextHighestDepth()); vBarBg.beginFill(0xcccccc, 25); vBarBg.lineTo(this._sliderInstance.width, 0); vBarBg.lineTo(this._sliderInstance.width, 1); vBarBg.lineTo(0, 1); vBarBg.endFill(); vBarBg.beginFill(0x666666, 25); vBarBg.moveTo(0, 0); vBarBg.lineTo(0, -1); vBarBg.lineTo(this._sliderInstance.width, -1); vBarBg.lineTo(this._sliderInstance.width, 0); vBarBg.endFill(); vBarBg._y = this._height / 2; // barre de chargement var vLoading = this._sliderInstance.createEmptyMovieClip("loading_mc", this._sliderInstance.getNextHighestDepth()); vLoading.beginFill(this._loadingColor, 75); vLoading.moveTo(0, -1) vLoading.lineTo(this._sliderInstance.width, -1); vLoading.lineTo(this._sliderInstance.width, 1); vLoading.lineTo(0, 1); vLoading.endFill(); vLoading._y = this._height / 2; vLoading._xscale = 0; vLoading._visible = false; // barre slider var vSlider = this._sliderInstance.createEmptyMovieClip("bar_mc", this._sliderInstance.getNextHighestDepth()); vSlider.parent = this; vSlider.margin = vMargin; vSlider.width = this.sliderWidth; vSlider.barWidth = this._sliderInstance.width; vSlider.color = new Color(vSlider); vSlider.onRollOver = function(){ this.color.setRGB(this.parent._sliderOverColor); }; vSlider.onRollOut = function(){ var transform:Object = {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0}; this.color.setTransform(transform); }; vSlider.onPress = function(){ this.startDrag(false, 0, this._y, this.barWidth - this.width, this._y); this.parent._sound.stop(); delete this.parent._sliderInstance.onEnterFrame; }; vSlider.onRelease = vSlider.onReleaseOutside = function(){ this.stopDrag(); var position:Number = this._x / (this.barWidth - this.width) * this.parent._sound.duration; this.parent._position = position; if(!this.parent._playButtonInstance.area_mc.enabled){ this.parent.play(); } }; vSlider.beginGradientFill("linear", [this._sliderColor1, this._sliderColor2], [100,100], [50,150], {matrixType:"box", x:0, y:0, w:this.sliderWidth, h:this.sliderHeight, r:Math.PI/2}); vSlider.moveTo(0, 4); vSlider.lineTo(0, this.sliderHeight - 4); vSlider.curveTo(0, this.sliderHeight, 4, this.sliderHeight); vSlider.lineTo(this.sliderWidth - 4, this.sliderHeight); vSlider.curveTo(this.sliderWidth, this.sliderHeight, this.sliderWidth, this.sliderHeight - 4); vSlider.lineTo(this.sliderWidth, 4); vSlider.curveTo(this.sliderWidth, 0, this.sliderWidth - 4, 0); vSlider.lineTo(4, 0); vSlider.curveTo(0, 0, 0, 4); vSlider.endFill(); vSlider._y = this._height/2 - this.sliderHeight / 2; } /** * Initialisation du son */ private function _initSound(){ this._sound = new Sound(); this._sound.onSoundComplete = this._delegate(this, function(){ if(this._loop){ this._position = 0; this.play(); }else{ this.stop(); } }); this._sound.setVolume(this._volume); } /** * Chargement */ private function _loading(){ var percent:Number = Math.round(this._sound.getBytesLoaded() / this._sound.getBytesTotal() * 100); this._sliderInstance.loading_mc._xscale = (percent >= 1)?percent:0; if(percent == 100){ this._sliderInstance.loading_mc._visible = false; delete this._sliderInstance.loading_mc.onEnterFrame; } } /** * Délégation de fonction * @param pTarget La cible * @param pFunc La fonction */ private function _delegate(pTarget:Object, pFunc:Function):Function{ var f:Function = function(){ var target = arguments.callee.target; var func = arguments.callee.func; return func.apply(target); }; f.target = pTarget; f.func = pFunc; return f; } /** * Le enterFrame du slider */ private function _sliderEnterFrame(){ var total:Number = (this._sliderInstance.loading_mc._visible)?this._sliderInstance.loading_mc._width:this._sliderInstance.width - this.sliderWidth; var position:Number = Math.round(this._sound.position/this._sound.duration * total); this._sliderInstance.bar_mc._x = position; } /** * Converti les millisecondes en temps * @param milli Les millisecondes à convertir * @return Une représentation du temps */ private function _milli2time(milli:Number):String{ var min:Number = Math.floor(milli / (1000 * 60)); var sec:Number = Math.floor(milli / 1000) % 60; return ((min < 10)?"0"+min:min) + ":" + ((sec < 10)?"0"+sec:sec); } /*===================== FIN = METHODES PRIVEES = FIN =====================*/ /*========================================================================*/ /*============================ GETTER SETTER ============================*/ /*========================================================================*/ /*====================== FIN = GETTER SETTER = FIN ======================*/ /*========================================================================*/ /*========================== METHODES PUBLIQUES ==========================*/ /*========================================================================*/ /** * PLAY */ public function play(){ if(!this._firstPlay){ this._sound.loadSound(this._url, true); this._sliderInstance.loading_mc.onEnterFrame = this._delegate(this, this._loading); this._sliderInstance.loading_mc._visible = true; this._firstPlay = true; } this._enableButton(this._playButtonInstance, false, true); this._enableButton(this._pauseButtonInstance, true); this._enableButton(this._stopButtonInstance, true); this._sound.start(Math.round(this._position / 1000)); this._sliderInstance.onEnterFrame = this._delegate(this, this._sliderEnterFrame); } /** * PAUSE */ public function pause(){ this._enableButton(this._pauseButtonInstance, false, true); this._enableButton(this._playButtonInstance, true); this._position = this._sound.position; this._sound.stop(); delete this._sliderInstance.onEnterFrame; } /** * STOP */ public function stop(){ this._enableButton(this._stopButtonInstance, false); this._enableButton(this._pauseButtonInstance, false, true); this._enableButton(this._playButtonInstance, true); this._position = 0; this._sound.stop(); this._sliderInstance.bar_mc._x = 0; delete this._sliderInstance.onEnterFrame; } /** * INFO */ public function info(){ if(this._infoPanel._visible = !this._infoPanel._visible) this._infoPanel.onEnterFrame = this._infoPanel.update; else delete this._infoPanel.onEnterFrame; } /*==================== FIN = METHODES PUBLIQUES = FIN ====================*/ /*========================================================================*/ }