diff --git a/build.xml b/build.xml index 918aba0..fcd5001 100644 --- a/build.xml +++ b/build.xml @@ -6,9 +6,9 @@ - @@ -16,9 +16,9 @@ - @@ -26,9 +26,9 @@ - @@ -36,9 +36,9 @@ - @@ -46,14 +46,14 @@ - - - + + @@ -71,4 +71,4 @@ - \ No newline at end of file + diff --git a/classes/ATemplate.as b/classes/ATemplate.as index 20b1726..7f26cb5 100644 --- a/classes/ATemplate.as +++ b/classes/ATemplate.as @@ -1,4 +1,4 @@ -/* +/* Version: MPL 1.1 The contents of this file are subject to the Mozilla Public License @@ -15,32 +15,35 @@ The Original Code is mp3player (http://code.google.com/p/mp3player/). The Initial Developer of the Original Code is neolao (neolao@gmail.com). */ -/** +/** * Classe abstraite pour un thème - * - * @author neolao - * @version 0.9 (02/04/2006) - * @license http://creativecommons.org/licenses/by-sa/2.5/ - */ + * + * @author neolao + * @version 0.9 (02/04/2006) + * @license http://creativecommons.org/licenses/by-sa/2.5/ + */ class ATemplate { // ------------------------------ VARIABLES -------------------------------- /** - * L'instance du lecteur */ + * L'instance du lecteur + */ public var player:PlayerBasic; /** - * Les raccourcis clavier */ + * Les raccourcis clavier + */ private var _shortcuts:Array; - + /*============================= CONSTRUCTEUR =============================*/ /*========================================================================*/ /** - * Initialisation */ + * Initialisation + */ private function ATemplate() { this._shortcuts = new Array(); this._initKey(); - + if (_global._accProps == undefined) { _global._accProps = new Object(); } @@ -48,15 +51,16 @@ class ATemplate } /*======================= FIN = CONSTRUCTEUR = FIN =======================*/ /*========================================================================*/ - + /*=========================== METHODES PRIVEES ===========================*/ /*========================================================================*/ /** - * Initialisation du gestionnaire de clavier */ + * Initialisation du gestionnaire de clavier + */ private function _initKey() { var o:Object = new Object(); - o.onKeyUp = this.delegate(this, function() + o.onKeyUp = this.delegate(this, function() { if (this._shortcuts[Key.getCode()]) { this._shortcuts[Key.getCode()](); @@ -66,15 +70,17 @@ class ATemplate } /** * Ajouter un raccourci clavier - * - * @param pKeyCode Le code de la touche * @param pFunction La fonction à exécuter */ + * + * @param pKeyCode Le code de la touche + * @param pFunction La fonction à exécuter + */ private function _addShortcut(pKeyCode:Number, pFunction:Function) { this._shortcuts[pKeyCode] = pFunction; } /*===================== FIN = METHODES PRIVEES = FIN =====================*/ /*========================================================================*/ - + /*========================== METHODES PUBLIQUES ==========================*/ /*========================================================================*/ /** @@ -106,29 +112,29 @@ class ATemplate */ public function startLoading() { - + } /** * Délégation de fonction - * + * * @param pTarget La cible * @param pFunc La fonction * @return La même fonction avec un scope fixe */ public function delegate(pTarget:Object, pFunc:Function):Function { - var f:Function = function() + var f:Function = function():Object { - var target = arguments.callee.target; - var func = arguments.callee.func; + var target:String = arguments.callee.target; + var func:Function = arguments.callee.func; return func.apply(target); }; - + f.target = pTarget; f.func = pFunc; - + return f; } /*==================== FIN = METHODES PUBLIQUES = FIN ====================*/ /*========================================================================*/ -} \ No newline at end of file +} diff --git a/template_default/player_mp3.swf b/template_default/player_mp3.swf index 0077527..36c504c 100644 Binary files a/template_default/player_mp3.swf and b/template_default/player_mp3.swf differ diff --git a/template_js/player_mp3_js.swf b/template_js/player_mp3_js.swf index 0830998..090aaa6 100644 Binary files a/template_js/player_mp3_js.swf and b/template_js/player_mp3_js.swf differ diff --git a/template_maxi/TemplateMaxi.as b/template_maxi/TemplateMaxi.as index 9baab12..33f11e0 100644 --- a/template_maxi/TemplateMaxi.as +++ b/template_maxi/TemplateMaxi.as @@ -1,4 +1,4 @@ -/* +/* Version: MPL 1.1 The contents of this file are subject to the Mozilla Public License @@ -15,23 +15,29 @@ The Original Code is mp3player (http://code.google.com/p/mp3player/). The Initial Developer of the Original Code is neolao (neolao@gmail.com). */ -/** - * Thème avec plein de choses pour le lecteur mp3 - * - * @author neolao - * @version 0.6.2 (11/09/2008) +/** + * Template for several mp3 + * + * @author neolao + * @version 1.2.1 (04/01/2008) * @license http://creativecommons.org/licenses/by-sa/3.0/deed.fr - */ -class TemplateMaxi extends ATemplate + */ +class TemplateMulti extends ATemplate { // ------------------------------ VARIABLES -------------------------------- /** - * Largeur du thème */ + * Template width + */ private var _width:Number = 200; /** - * Hauteur du thème */ - private var _height:Number = 20; - + * Template height + */ + private var _height:Number = 100; + /** + * Toolbar height + */ + private var _playerHeight:Number = 20; + private var _backgroundSkin:String; private var _backgroundColor:Number; private var _backgroundColor1:Number = 0x7c7c7c; @@ -43,60 +49,78 @@ class TemplateMaxi extends ATemplate private var _sliderOverColor:Number = 0xeeee00; private var _textColor:Number = 0xffffff; private var _loadingColor:Number = 0xffff00; - private var _showStop:Boolean = false; + private var _playlistColor:Number = 0x000000; + private var _playlistAlpha:Number = 50; + private var _currentMp3Color:Number = 0xffff00; + private var _scrollbarColor:Number = 0xffffff; + private var _scrollbarOverColor:Number = 0xffff00; + private var _showList:Boolean = true; + private var _showSlider:Boolean = true; + private var _title:Array; private var _showInfo:Boolean = false; private var _showVolume:Boolean = false; - private var _showSlider:Boolean = true; private var _volume:Number = 100; private var _volumeMax:Number = 200; private var _showLoading:String = "autohide"; // always, autohide, never - + private var _showPlaylistNumbers:Boolean = true; + public var buttonWidth:Number = 26; public var volumeWidth:Number = 30; public var volumeHeight:Number = 6; public var sliderWidth:Number = 20; public var sliderHeight:Number = 10; - + private var _target:MovieClip = _root; private var _backgroundInstance:MovieClip; + private var _previousButtonInstance:MovieClip; private var _playButtonInstance:MovieClip; private var _pauseButtonInstance:MovieClip; private var _stopButtonInstance:MovieClip; private var _infoButtonInstance:MovieClip; private var _infoPanel:MovieClip; + private var _nextButtonInstance:MovieClip; private var _volumeButtonInstance:MovieClip; private var _separatorsInstance:MovieClip; private var _sliderInstance:MovieClip; private var _loadingInstance:MovieClip; - + private var _playlistInstance:MovieClip; + private var _scrollbarInstance:MovieClip; + + private var _currentIndex:Number = 0; + /*============================= CONSTRUCTEUR =============================*/ /*========================================================================*/ /** - * Initialisation - * - * @param pConfig La configuration par défaut + * Constructor */ - public function TemplateMaxi(pConfig:Object) + public function TemplateMulti() { super(); - - this._initVars(pConfig); + + // Initialisation du Stage + Stage.scaleMode = "noScale"; + Stage.align = "TL"; + + this._initVars(); + + if (!this._showList) { + this._height = this._playerHeight; + } + this._initBackground(); + this._initPreviousButton(); this._initPlayButton(); this._initPauseButton(); this._initStopButton(); this._initInfoButton(); + this._initNextButton(); this._initVolumeButton(); - - var vMarginSlider:Number = this.buttonWidth; - var vSeparators:Array = new Array(); - if (this._showSlider) { - vSeparators.push(this.buttonWidth); - } - if (this._showStop) { - vMarginSlider += this.buttonWidth; - vSeparators.push(this.buttonWidth); - } + + var vMarginSlider:Number = this.buttonWidth*4; + var vSeparators:Array = [this.buttonWidth, + this.buttonWidth, + this.buttonWidth, + this.buttonWidth]; if (this._showInfo) { vMarginSlider += this.buttonWidth; vSeparators.push(this.buttonWidth); @@ -105,11 +129,30 @@ class TemplateMaxi extends ATemplate vMarginSlider += this.volumeWidth; vSeparators.push(this.volumeWidth); } - this._initSlider(vMarginSlider); + if (this._showSlider) { + this._initSlider(vMarginSlider); + } else { + vMarginSlider -= this.buttonWidth; + vSeparators.pop(); + } this._createSeparators(vSeparators); - + + // Si la playlist est générée avec un fichier + // Alors il ne faut pas encore créer l'affichage de la playlist + if (_root.playlist != undefined) { + this._loadPlaylist(_root.playlist); + } else { + // Use postcast rss + if (_root.playlistrss != undefined) { + this._loadPlaylistRss(_root.playlistrss); + } else { + this._initPlaylist(); + } + } + + this._initInfoPanel(); - + // Raccourcis clavier var vPlayPause:Function = this.delegate(this, function() { @@ -156,6 +199,20 @@ class TemplateMaxi extends ATemplate { this.player.setPosition(this.player.getPosition() + 5000); })); + // touche flèche haut + this._addShortcut(38, this.delegate(this, function() + { + if (this.player.hasPrevious) { + this.previousRelease(); + } + })); + // touche flèche bas + this._addShortcut(40, this.delegate(this, function() + { + if (this.player.hasNext) { + this.nextRelease(); + } + })); // touche "-" this._addShortcut(109, vDecreaseVolume); this._addShortcut(189, vDecreaseVolume); @@ -167,16 +224,13 @@ class TemplateMaxi extends ATemplate { this.infoRelease(); })); - - - // Update accessibility properties - Accessibility.updateProperties(); } /** - * Lancé par mtasc + * Launched by mtasc */ static function main():Void { + // On vérifie s'il y a un fichier de configuration à charger if (_root.config != undefined) { // Fichier de configuration texte @@ -185,8 +239,8 @@ class TemplateMaxi extends ATemplate if (data != undefined) { data = data.split("\r\n").join("\n"); var newdata:Array = data.split("\n"); - - for (var i=0; i 0) { // On peut scroller this.info_txt.text += sep; var textLength:Number = this.info_txt.length; - + this.info_txt.text = this.info_txt.text.substring(this.scrollMemo, textLength) + this.info_txt.text.substring(0, this.scrollMemo - 1); if (++this.waitScroll > 5) { this.scrollMemo += 1; @@ -644,6 +816,37 @@ class TemplateMaxi extends ATemplate }; } } + /** + * Initialisation du bouton Next + */ + private function _initNextButton() + { + // Création + if (this._nextButtonInstance == undefined) { + this._nextButtonInstance = this._target.createEmptyMovieClip("next_btn", this._target.getNextHighestDepth()); + this._initButton(this._nextButtonInstance); + } + + // Position + this._nextButtonInstance._x = (this._showInfo)?this.buttonWidth*4:this.buttonWidth*3; + + // Action + this._nextButtonInstance.area_mc.onRelease = this.delegate(this, this.nextRelease); + + // Icone + this._nextButtonInstance.icon_mc.beginFill(this._buttonColor); + this._nextButtonInstance.icon_mc.lineTo(0, 8); + this._nextButtonInstance.icon_mc.lineTo(6, 4); + this._nextButtonInstance.icon_mc.endFill(); + this._nextButtonInstance.icon_mc.moveTo(6, 0); + this._nextButtonInstance.icon_mc.beginFill(this._buttonColor); + this._nextButtonInstance.icon_mc.lineTo(8, 0); + this._nextButtonInstance.icon_mc.lineTo(8, 8); + this._nextButtonInstance.icon_mc.lineTo(6, 8); + this._nextButtonInstance.icon_mc.endFill(); + this._nextButtonInstance.icon_mc._y = this._playerHeight/2 - this._nextButtonInstance.icon_mc._height/2; + this._nextButtonInstance.icon_mc._x = this.buttonWidth/2 - this._nextButtonInstance.icon_mc._width/2; + } /** * Initialisation du bouton Volume */ @@ -652,20 +855,14 @@ class TemplateMaxi extends ATemplate if (this._showVolume) { this._volumeButtonInstance = this._target.createEmptyMovieClip("volume_btn", this._target.getNextHighestDepth()); this._initButton(this._volumeButtonInstance, this.volumeWidth); - - this._volumeButtonInstance._x = this.buttonWidth; - if (this._showStop) { - this._volumeButtonInstance._x += this.buttonWidth; - } - if (this._showInfo) { - this._volumeButtonInstance._x += this.buttonWidth; - } - - + + // Position + this._volumeButtonInstance._x = (this._showInfo)?this.buttonWidth*5:this.buttonWidth*4; + this._volumeButtonInstance.area_mc.onPress = this.delegate(this, this._volumePress); this._volumeButtonInstance.area_mc.onRelease = this.delegate(this, this._volumeRelease); this._volumeButtonInstance.area_mc.onReleaseOutside = this.delegate(this, this._volumeRelease); - + // icone fond var vIconBackground:MovieClip = this._volumeButtonInstance.icon_mc.createEmptyMovieClip("background_mc", 1); vIconBackground.beginFill(this._buttonColor, 25); @@ -673,15 +870,16 @@ class TemplateMaxi extends ATemplate vIconBackground.lineTo(this.volumeWidth - 8, this.volumeHeight); vIconBackground.lineTo(this.volumeWidth - 8, 0); vIconBackground.endFill(); - vIconBackground._y = this._height/2 - vIconBackground._height/2; + vIconBackground._y = this._playerHeight/2 - vIconBackground._height/2; vIconBackground._x = this.volumeWidth/2 - vIconBackground._width/2; - + // icone this._updateVolume(); } } /** - * Mise à jour du bouton Volume */ + * Mise à jour du bouton Volume + */ private function _updateVolume() { var vIcon:MovieClip; @@ -691,14 +889,14 @@ class TemplateMaxi extends ATemplate vIcon = this._volumeButtonInstance.icon_mc.current_mc; } vIcon.clear(); - + if (this._volume > this._volumeMax) { this._volume = this._volumeMax; } - + var vWidth:Number = (this.volumeWidth - 8) * this._volume / this._volumeMax; var vRatio:Number = this._volume / this._volumeMax; - + vIcon.beginFill(this._buttonColor); vIcon.moveTo(0, this.volumeHeight); vIcon.lineTo(vWidth, this.volumeHeight); @@ -708,7 +906,8 @@ class TemplateMaxi extends ATemplate vIcon._x = vIcon._parent.background_mc._x; } /** - * Le enterFrame pendant l'appui du bouton Volume */ + * Le enterFrame pendant l'appui du bouton Volume + */ private function _volumeEnterFrame() { var xmouse:Number = this._volumeButtonInstance.icon_mc.current_mc._xmouse; @@ -719,173 +918,355 @@ class TemplateMaxi extends ATemplate if (xmouse > max) { xmouse = max; } - + var volume:Number = xmouse * this._volumeMax / max; this.setVolume(volume); } /** - * On appuie sur le bouton Volume */ + * On appuie sur le bouton Volume + */ private function _volumePress() { this._volumeButtonInstance.onEnterFrame = this.delegate(this, this._volumeEnterFrame); } /** - * On relâche le bouton Volume */ + * On relâche le bouton Volume + */ private function _volumeRelease() { delete this._volumeButtonInstance.onEnterFrame; } /** * Initialisation de la barre - * + * * @param pMargin La marge gauche de la barre */ private function _initSlider(pMargin:Number) { - this._sliderInstance = this._target.createEmptyMovieClip("slider_mc", this._target.getNextHighestDepth()); - - if (this._showSlider) { - - // calcul de la taille - var vMargin:Number = pMargin; - 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 - this._loadingInstance = this._sliderInstance.createEmptyMovieClip("loading_mc", this._sliderInstance.getNextHighestDepth()); - this._loadingInstance.beginFill(this._loadingColor, 75); - this._loadingInstance.moveTo(0, -1) - this._loadingInstance.lineTo(this._sliderInstance.width, -1); - this._loadingInstance.lineTo(this._sliderInstance.width, 1); - this._loadingInstance.lineTo(0, 1); - this._loadingInstance.endFill(); - this._loadingInstance._y = this._height / 2; - this._loadingInstance._xscale = 0; - this._loadingInstance._visible = false; - - - // barre slider - var vSlider:MovieClip = 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.tabEnabled = false; - if (vSlider._accProps == undefined) { - vSlider._accProps = new Object(); - } - vSlider._accProps.silent = true; - vSlider._accProps.name = "Slider"; - 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); - delete this.parent._sliderInstance.onEnterFrame; - }; - vSlider.onRelease = vSlider.onReleaseOutside = function() - { - this.stopDrag(); - var position:Number = this._x / (this.barWidth - this.width) * this.parent.player.getDuration(); - this.parent.player.setPosition(position); - if (this.parent.player.isPlaying) { - this.parent.playRelease(); - } - }; - - 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; + if (this._sliderInstance == undefined) { + this._sliderInstance = this._target.createEmptyMovieClip("slider_mc", this._target.getNextHighestDepth()); } + + // calcul de la taille + var vMargin:Number = pMargin; + 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._playerHeight / 2; + + + // barre de chargement + this._loadingInstance = this._sliderInstance.createEmptyMovieClip("loading_mc", this._sliderInstance.getNextHighestDepth()); + this._loadingInstance.beginFill(this._loadingColor, 75); + this._loadingInstance.moveTo(0, -1) + this._loadingInstance.lineTo(this._sliderInstance.width, -1); + this._loadingInstance.lineTo(this._sliderInstance.width, 1); + this._loadingInstance.lineTo(0, 1); + this._loadingInstance.endFill(); + this._loadingInstance._y = this._playerHeight / 2; + this._loadingInstance._xscale = 0; + this._loadingInstance._visible = false; + + + // barre slider + var vSlider:MovieClip = 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); + delete this.parent._sliderInstance.onEnterFrame; + }; + vSlider.onRelease = vSlider.onReleaseOutside = function() + { + this.stopDrag(); + var position:Number = this._x / (this.barWidth - this.width) * this.parent.player.getDuration(); + this.parent.player.setPosition(position); + if (this.parent.player.isPlaying) { + this.parent.playRelease(); + } + }; + + 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._playerHeight/2 - this.sliderHeight / 2; } /** * Chargement */ - private function _loading(){ + private function _loading() + { var objLoading:Object = this.player.getLoading(); - this._loadingInstance._xscale = (objLoading.percent >= 1)?objLoading.percent:0; - if (objLoading.percent == 100) { + this._loadingInstance._xscale = (objLoading.percent >= 1)?objLoading.percent:0; + if (objLoading.percent == 100) { if (this._showLoading != "always") { this._loadingInstance._visible = false; } - delete this._loadingInstance.onEnterFrame; - } - } - /** - * Le enterFrame du slider - */ - private function _sliderEnterFrame() { - var total:Number = 0; - var position:Number = 0; - var threshold:Number = 10; // threshold of the stop detection - - if (this._showSlider) { - total = (this._sliderInstance.loading_mc._visible)?this._sliderInstance.loading_mc._width:this._sliderInstance.width - this.sliderWidth; - position = Math.round(this.player.getPosition()/this.player.getDuration() * total); - this._sliderInstance.bar_mc._x = position; - } else { - total = this.player.getDuration(); - position = this.player.getPosition(); - - threshold = 400; - - // if the duration of the sound is below 2 seconds - if (total < 2000) { - threshold = 800; - } - } - - if (!this.player.isPlaying && Math.abs(total - position) < threshold) { + delete this._loadingInstance.onEnterFrame; + } + } + /** + * 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.player.getPosition()/this.player.getDuration() * total); + this._sliderInstance.bar_mc._x = position; + + if (!this.player.isPlaying && position == total) { this.stopRelease(); } + if (this._currentIndex != this.player.index) { + this._currentIndex = this.player.index; + this.updatePlaylist(); + } + } + /** + * Initialisation de la playlist + * @return true + */ + private function _initPlaylist():Boolean + { + var totalMp3:Number = _root.mp3.split("|").length; + var version:String = System.capabilities.version; + if (version.indexOf("MAC") != -1) { + totalMp3++; + } + + // On vérifie si on affiche la playlist ou pas + if (!this._showList) { + return true; + } + + // Création + this._playlistInstance = this._target.createEmptyMovieClip("playlist_mc", this._target.getNextHighestDepth()); + + // Position + this._playlistInstance._y = this._playerHeight; + + // Fond + if (this._backgroundSkin == undefined) { + this._playlistInstance.moveTo(5, 0); + this._playlistInstance.beginFill(this._playlistColor, this._playlistAlpha); + this._playlistInstance.lineTo(this._width - 5, 0); + this._playlistInstance.lineTo(this._width - 5, this._height - this._playerHeight - 5); + this._playlistInstance.lineTo(5, this._height - this._playerHeight - 5); + this._playlistInstance.endFill(); + } + + // Champ de texte + this._playlistInstance.createTextField("list_txt", 1, 5, 0, this._width - 20, this._height - this._playerHeight); + //this._playlistInstance.list_txt.selectable = false; + this._playlistInstance.list_txt.html = true; + + // Remplissage du champ pour vérifier si ca scroll + this._playlistInstance.list_txt.text = ""; + for (var i:Number=0; i 1) { + this._scrollbarInstance = this._playlistInstance.createEmptyMovieClip("scrollbar_mc", 2); + this._scrollbarInstance.beginFill(this._scrollbarColor); + this._scrollbarInstance.lineTo(4, 0); + this._scrollbarInstance.lineTo(4, this._height - this._playerHeight - 5); + this._scrollbarInstance.lineTo(0, this._height - this._playerHeight - 5); + this._scrollbarInstance.endFill(); + this._scrollbarInstance._x = this._width - 10; + this._scrollbarInstance._yscale = (totalMp3 - this._playlistInstance.list_txt.maxscroll + 1)/totalMp3 * 100; + this._scrollbarInstance.max = (this._height - this._playerHeight - 5) - this._scrollbarInstance._height; + this._scrollbarInstance.step = this._scrollbarInstance.max / (this._playlistInstance.list_txt.maxscroll - 1); + this._scrollbarInstance.color = new Color(this._scrollbarInstance); + this._scrollbarInstance.colorOver = this._scrollbarOverColor; + this._scrollbarInstance.onRollOver = function() + { + this.color.setRGB(this.colorOver); + }; + this._scrollbarInstance.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); + }; + this._scrollbarInstance.onPress = function() + { + this.onEnterFrameAuto = this.onEnterFrame; + this.startDrag(false, this._x, 0, this._x, this.max); + this.onEnterFrame = function() + { + this._parent.list_txt.scroll = Math.floor((this._y+1) / this.step) + 1; + } + } + this._scrollbarInstance.onRelease = this._scrollbarInstance.onReleaseOutside = function() + { + this.stopDrag(); + this.onEnterFrame = this.onEnterFrameAuto; + } + this._scrollbarInstance.onEnterFrame = function() + { + if (this._parent.list_txt.scroll == this._parent.list_txt.maxscroll) { + this._y = this.max; + } else { + this._y = (this._parent.list_txt.scroll - 1) * this.step; + } + } + } + + // Mise à jour de la playlist en permanence + this._playlistInstance.waitScroll = 0; + this._playlistInstance.intervalScroll = 0; + this._playlistInstance.scrollMemo = 0; + this._playlistInstance.onEnterFrame = this.delegate(this, this.updatePlaylist); + + return true; } /*===================== FIN = METHODES PRIVEES = FIN =====================*/ /*========================================================================*/ - + /*========================== METHODES PUBLIQUES ==========================*/ /*========================================================================*/ /** - * Action sur le bouton play */ + * Mise à jour de la playlist + * + * @param pAutoScroll Indique qu'il faut scroller au bon endroit de la liste + */ + public function updatePlaylist(pAutoScroll:Boolean) + { + var text:String = "" + var title_tmp:String; + var color:String = this._textColor.toString(16); + + if (this.player.playlist.length > 0) { + text = ""; + } else { + text = "Liste vide"; + } + + // Génération des pistes + for (var i:Number=0; i"; + text += ""; + if (this._showPlaylistNumbers) { + text += (i+1) + " - "; + } + + // titre de la piste + if (this._title[i] != undefined) { + title_tmp = this._title[i]; + } else { + title_tmp = this.player.playlist[i]; + } + + // Défilement automatique pour la piste sélectionnée + this._playlistInstance.textfield_tmp.text = title_tmp; + if (i == this.player.index && this._playlistInstance.textfield_tmp.maxhscroll > 0) { + // On peut scroller + title_tmp += " - "; + var textLength:Number = title_tmp.length; + + if (++this._playlistInstance.waitScroll < 40) { + this._playlistInstance.intervalScroll = 0; + } + + title_tmp = title_tmp.substring(this._playlistInstance.scrollMemo, textLength) + title_tmp.substring(0, this._playlistInstance.scrollMemo - 1); + if (++this._playlistInstance.intervalScroll > 5) { + this._playlistInstance.scrollMemo += 1; + this._playlistInstance.intervalScroll = 0; + } + this._playlistInstance.scrollMemo = this._playlistInstance.scrollMemo % (textLength); + } + this._playlistInstance.textfield_tmp.text = ""; + + // La fin + text += title_tmp; + text += "\n"; + text += ""; + text += ""; + } + + this._playlistInstance.list_txt.htmlText = text; + + // Scroll automatique sur l'élément + if (pAutoScroll && this._playlistInstance.list_txt.maxscroll > 1) { + this._playlistInstance.list_txt.scroll = this._playlistInstance.list_txt.maxscroll - (this.player.playlist.length - 1 - this.player.index); + } + + // Boutons Previous et Next + this._enableButton(this._nextButtonInstance, this.player.hasNext); + this._enableButton(this._previousButtonInstance, this.player.hasPrevious); + } + /** + * Action sur le bouton Previous + */ + public function previousRelease() + { + this.player.previous(); + + this._currentIndex = this.player.index; + this.updatePlaylist(true); + } + /** + * Action sur le bouton Play + */ public function playRelease() { super.playRelease(); @@ -893,17 +1274,28 @@ class TemplateMaxi extends ATemplate this._enableButton(this._pauseButtonInstance, true); this._enableButton(this._stopButtonInstance, true); this._sliderInstance.onEnterFrame = this.delegate(this, this._sliderEnterFrame); + + this._currentIndex = this.player.index; + + this._playlistInstance.waitScroll = 0; + this._playlistInstance.intervalScroll = 0; + this._playlistInstance.scrollMemo = 0; + this.updatePlaylist(true); } - /** * Action sur le bouton pause + /** + * Action sur le bouton Pause */ public function pauseRelease() { super.pauseRelease(); this._enableButton(this._pauseButtonInstance, false, true); this._enableButton(this._playButtonInstance, true); + + this.updatePlaylist(); } /** - * Action sur le bouton stop */ + * Action sur le bouton Stop + */ public function stopRelease() { super.stopRelease(); @@ -911,13 +1303,13 @@ class TemplateMaxi extends ATemplate this._enableButton(this._pauseButtonInstance, false, true); this._enableButton(this._playButtonInstance, true); delete this._sliderInstance.onEnterFrame; - - if (this._showSlider) { - this._sliderInstance.bar_mc._x = 0; - } + this._sliderInstance.bar_mc._x = 0; + + this.updatePlaylist(); } /** - * Action sur le bouton info */ + * Action sur le bouton info + */ public function infoRelease() { if (this._infoPanel._visible = !this._infoPanel._visible) { @@ -926,11 +1318,22 @@ class TemplateMaxi extends ATemplate delete this._infoPanel.onEnterFrame; } } + /** + * Action sur le bouton Next + */ + public function nextRelease() + { + this.player.next(); + + this._currentIndex = this.player.index; + this.updatePlaylist(true); + } /** * Modifie le volume - * + * * Le maximum est de 200 - * @param pVolume Le nouveau volume */ + * @param pVolume Le nouveau volume + */ public function setVolume(pVolume:Number) { this._volume = pVolume; @@ -950,30 +1353,4 @@ class TemplateMaxi extends ATemplate } /*==================== FIN = METHODES PUBLIQUES = FIN ====================*/ /*========================================================================*/ - - /*========================= CONTROLES JAVASCRIPT =========================*/ - /*========================================================================*/ - public function set jsPlay(n:String) - { - this.playRelease(); - } - public function set jsPause(n:String) - { - this.pauseRelease(); - } - public function set jsStop(n:String) - { - this.stopRelease(); - } - public function set jsVolume(n:String) - { - this.setVolume(Number(n)); - } - public function set jsUrl(n:String) - { - this.player["_firstPlay"] = false; - _root.mp3 = n; - } - /*=================== FIN = CONTROLES JAVASCRIPT = FIN ===================*/ - /*========================================================================*/ -} \ No newline at end of file +} diff --git a/template_maxi/player_mp3_maxi.swf b/template_maxi/player_mp3_maxi.swf index b2fde33..b63f136 100644 Binary files a/template_maxi/player_mp3_maxi.swf and b/template_maxi/player_mp3_maxi.swf differ diff --git a/template_mini/player_mp3_mini.swf b/template_mini/player_mp3_mini.swf index 9e85c2e..4969ff6 100644 Binary files a/template_mini/player_mp3_mini.swf and b/template_mini/player_mp3_mini.swf differ diff --git a/template_multi/TemplateMulti.as b/template_multi/TemplateMulti.as index 2cd1e79..33f11e0 100644 --- a/template_multi/TemplateMulti.as +++ b/template_multi/TemplateMulti.as @@ -1,4 +1,4 @@ -/* +/* Version: MPL 1.1 The contents of this file are subject to the Mozilla Public License @@ -15,26 +15,29 @@ The Original Code is mp3player (http://code.google.com/p/mp3player/). The Initial Developer of the Original Code is neolao (neolao@gmail.com). */ -/** +/** * Template for several mp3 - * - * @author neolao - * @version 1.2.1 (04/01/2008) + * + * @author neolao + * @version 1.2.1 (04/01/2008) * @license http://creativecommons.org/licenses/by-sa/3.0/deed.fr - */ + */ class TemplateMulti extends ATemplate { // ------------------------------ VARIABLES -------------------------------- /** - * Template width */ + * Template width + */ private var _width:Number = 200; /** - * Template height */ + * Template height + */ private var _height:Number = 100; - /** * Toolbar height + /** + * Toolbar height */ private var _playerHeight:Number = 20; - + private var _backgroundSkin:String; private var _backgroundColor:Number; private var _backgroundColor1:Number = 0x7c7c7c; @@ -60,13 +63,13 @@ class TemplateMulti extends ATemplate private var _volumeMax:Number = 200; private var _showLoading:String = "autohide"; // always, autohide, never private var _showPlaylistNumbers:Boolean = true; - + public var buttonWidth:Number = 26; public var volumeWidth:Number = 30; public var volumeHeight:Number = 6; public var sliderWidth:Number = 20; public var sliderHeight:Number = 10; - + private var _target:MovieClip = _root; private var _backgroundInstance:MovieClip; private var _previousButtonInstance:MovieClip; @@ -82,9 +85,9 @@ class TemplateMulti extends ATemplate private var _loadingInstance:MovieClip; private var _playlistInstance:MovieClip; private var _scrollbarInstance:MovieClip; - + private var _currentIndex:Number = 0; - + /*============================= CONSTRUCTEUR =============================*/ /*========================================================================*/ /** @@ -93,17 +96,17 @@ class TemplateMulti extends ATemplate public function TemplateMulti() { super(); - + // Initialisation du Stage Stage.scaleMode = "noScale"; Stage.align = "TL"; - + this._initVars(); - + if (!this._showList) { this._height = this._playerHeight; } - + this._initBackground(); this._initPreviousButton(); this._initPlayButton(); @@ -112,11 +115,11 @@ class TemplateMulti extends ATemplate this._initInfoButton(); this._initNextButton(); this._initVolumeButton(); - + var vMarginSlider:Number = this.buttonWidth*4; - var vSeparators:Array = [this.buttonWidth, - this.buttonWidth, - this.buttonWidth, + var vSeparators:Array = [this.buttonWidth, + this.buttonWidth, + this.buttonWidth, this.buttonWidth]; if (this._showInfo) { vMarginSlider += this.buttonWidth; @@ -133,7 +136,7 @@ class TemplateMulti extends ATemplate vSeparators.pop(); } this._createSeparators(vSeparators); - + // Si la playlist est générée avec un fichier // Alors il ne faut pas encore créer l'affichage de la playlist if (_root.playlist != undefined) { @@ -146,10 +149,10 @@ class TemplateMulti extends ATemplate this._initPlaylist(); } } - - + + this._initInfoPanel(); - + // Raccourcis clavier var vPlayPause:Function = this.delegate(this, function() { @@ -227,7 +230,7 @@ class TemplateMulti extends ATemplate */ static function main():Void { - + // On vérifie s'il y a un fichier de configuration à charger if (_root.config != undefined) { // Fichier de configuration texte @@ -236,8 +239,8 @@ class TemplateMulti extends ATemplate if (data != undefined) { data = data.split("\r\n").join("\n"); var newdata:Array = data.split("\n"); - - for (var i=0; i 0) { // On peut scroller this.info_txt.text += sep; var textLength:Number = this.info_txt.length; - + this.info_txt.text = this.info_txt.text.substring(this.scrollMemo, textLength) + this.info_txt.text.substring(0, this.scrollMemo - 1); if (++this.waitScroll > 5) { this.scrollMemo += 1; @@ -819,16 +823,16 @@ class TemplateMulti extends ATemplate { // Création if (this._nextButtonInstance == undefined) { - this._nextButtonInstance = this._target.createEmptyMovieClip("next_btn", this._target.getNextHighestDepth()); + this._nextButtonInstance = this._target.createEmptyMovieClip("next_btn", this._target.getNextHighestDepth()); this._initButton(this._nextButtonInstance); - } - + } + // Position this._nextButtonInstance._x = (this._showInfo)?this.buttonWidth*4:this.buttonWidth*3; - + // Action this._nextButtonInstance.area_mc.onRelease = this.delegate(this, this.nextRelease); - + // Icone this._nextButtonInstance.icon_mc.beginFill(this._buttonColor); this._nextButtonInstance.icon_mc.lineTo(0, 8); @@ -851,14 +855,14 @@ class TemplateMulti extends ATemplate if (this._showVolume) { this._volumeButtonInstance = this._target.createEmptyMovieClip("volume_btn", this._target.getNextHighestDepth()); this._initButton(this._volumeButtonInstance, this.volumeWidth); - + // Position this._volumeButtonInstance._x = (this._showInfo)?this.buttonWidth*5:this.buttonWidth*4; - + this._volumeButtonInstance.area_mc.onPress = this.delegate(this, this._volumePress); this._volumeButtonInstance.area_mc.onRelease = this.delegate(this, this._volumeRelease); this._volumeButtonInstance.area_mc.onReleaseOutside = this.delegate(this, this._volumeRelease); - + // icone fond var vIconBackground:MovieClip = this._volumeButtonInstance.icon_mc.createEmptyMovieClip("background_mc", 1); vIconBackground.beginFill(this._buttonColor, 25); @@ -868,7 +872,7 @@ class TemplateMulti extends ATemplate vIconBackground.endFill(); vIconBackground._y = this._playerHeight/2 - vIconBackground._height/2; vIconBackground._x = this.volumeWidth/2 - vIconBackground._width/2; - + // icone this._updateVolume(); } @@ -885,14 +889,14 @@ class TemplateMulti extends ATemplate vIcon = this._volumeButtonInstance.icon_mc.current_mc; } vIcon.clear(); - + if (this._volume > this._volumeMax) { this._volume = this._volumeMax; } - + var vWidth:Number = (this.volumeWidth - 8) * this._volume / this._volumeMax; var vRatio:Number = this._volume / this._volumeMax; - + vIcon.beginFill(this._buttonColor); vIcon.moveTo(0, this.volumeHeight); vIcon.lineTo(vWidth, this.volumeHeight); @@ -914,7 +918,7 @@ class TemplateMulti extends ATemplate if (xmouse > max) { xmouse = max; } - + var volume:Number = xmouse * this._volumeMax / max; this.setVolume(volume); } @@ -934,7 +938,7 @@ class TemplateMulti extends ATemplate } /** * Initialisation de la barre - * + * * @param pMargin La marge gauche de la barre */ private function _initSlider(pMargin:Number) @@ -942,17 +946,17 @@ class TemplateMulti extends ATemplate if (this._sliderInstance == undefined) { this._sliderInstance = this._target.createEmptyMovieClip("slider_mc", this._target.getNextHighestDepth()); } - + // calcul de la taille var vMargin:Number = pMargin; 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()); + 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); @@ -964,58 +968,58 @@ class TemplateMulti extends ATemplate vBarBg.lineTo(this._sliderInstance.width, -1); vBarBg.lineTo(this._sliderInstance.width, 0); vBarBg.endFill(); - vBarBg._y = this._playerHeight / 2; - - + vBarBg._y = this._playerHeight / 2; + + // barre de chargement this._loadingInstance = this._sliderInstance.createEmptyMovieClip("loading_mc", this._sliderInstance.getNextHighestDepth()); - this._loadingInstance.beginFill(this._loadingColor, 75); - this._loadingInstance.moveTo(0, -1) - this._loadingInstance.lineTo(this._sliderInstance.width, -1); - this._loadingInstance.lineTo(this._sliderInstance.width, 1); - this._loadingInstance.lineTo(0, 1); + this._loadingInstance.beginFill(this._loadingColor, 75); + this._loadingInstance.moveTo(0, -1) + this._loadingInstance.lineTo(this._sliderInstance.width, -1); + this._loadingInstance.lineTo(this._sliderInstance.width, 1); + this._loadingInstance.lineTo(0, 1); this._loadingInstance.endFill(); - this._loadingInstance._y = this._playerHeight / 2; - this._loadingInstance._xscale = 0; - this._loadingInstance._visible = false; - - - // barre slider - var vSlider:MovieClip = this._sliderInstance.createEmptyMovieClip("bar_mc", this._sliderInstance.getNextHighestDepth()); + this._loadingInstance._y = this._playerHeight / 2; + this._loadingInstance._xscale = 0; + this._loadingInstance._visible = false; + + + // barre slider + var vSlider:MovieClip = 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); - }; + { + 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); - }; + { + 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.startDrag(false, 0, this._y, this.barWidth - this.width, this._y); delete this.parent._sliderInstance.onEnterFrame; - }; + }; vSlider.onRelease = vSlider.onReleaseOutside = function() - { - this.stopDrag(); - var position:Number = this._x / (this.barWidth - this.width) * this.parent.player.getDuration(); + { + this.stopDrag(); + var position:Number = this._x / (this.barWidth - this.width) * this.parent.player.getDuration(); this.parent.player.setPosition(position); if (this.parent.player.isPlaying) { this.parent.playRelease(); } - }; - - 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.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); @@ -1034,23 +1038,23 @@ class TemplateMulti extends ATemplate private function _loading() { var objLoading:Object = this.player.getLoading(); - this._loadingInstance._xscale = (objLoading.percent >= 1)?objLoading.percent:0; + this._loadingInstance._xscale = (objLoading.percent >= 1)?objLoading.percent:0; if (objLoading.percent == 100) { if (this._showLoading != "always") { this._loadingInstance._visible = false; } - delete this._loadingInstance.onEnterFrame; + delete this._loadingInstance.onEnterFrame; } } - /** - * Le enterFrame du slider - */ + /** + * 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.player.getPosition()/this.player.getDuration() * total); + var position:Number = Math.round(this.player.getPosition()/this.player.getDuration() * total); this._sliderInstance.bar_mc._x = position; - + if (!this.player.isPlaying && position == total) { this.stopRelease(); } @@ -1061,7 +1065,8 @@ class TemplateMulti extends ATemplate } /** * Initialisation de la playlist - * @return true */ + * @return true + */ private function _initPlaylist():Boolean { var totalMp3:Number = _root.mp3.split("|").length; @@ -1069,18 +1074,18 @@ class TemplateMulti extends ATemplate if (version.indexOf("MAC") != -1) { totalMp3++; } - + // On vérifie si on affiche la playlist ou pas if (!this._showList) { return true; } - + // Création this._playlistInstance = this._target.createEmptyMovieClip("playlist_mc", this._target.getNextHighestDepth()); - + // Position this._playlistInstance._y = this._playerHeight; - + // Fond if (this._backgroundSkin == undefined) { this._playlistInstance.moveTo(5, 0); @@ -1090,21 +1095,21 @@ class TemplateMulti extends ATemplate this._playlistInstance.lineTo(5, this._height - this._playerHeight - 5); this._playlistInstance.endFill(); } - + // Champ de texte this._playlistInstance.createTextField("list_txt", 1, 5, 0, this._width - 20, this._height - this._playerHeight); //this._playlistInstance.list_txt.selectable = false; this._playlistInstance.list_txt.html = true; - + // Remplissage du champ pour vérifier si ca scroll this._playlistInstance.list_txt.text = ""; for (var i:Number=0; i 1) { this._scrollbarInstance = this._playlistInstance.createEmptyMovieClip("scrollbar_mc", 2); @@ -1128,14 +1133,14 @@ class TemplateMulti extends ATemplate this._scrollbarInstance.color = new Color(this._scrollbarInstance); this._scrollbarInstance.colorOver = this._scrollbarOverColor; this._scrollbarInstance.onRollOver = function() - { - this.color.setRGB(this.colorOver); - }; + { + this.color.setRGB(this.colorOver); + }; this._scrollbarInstance.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); - }; + { + var transform:Object = {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0}; + this.color.setTransform(transform); + }; this._scrollbarInstance.onPress = function() { this.onEnterFrameAuto = this.onEnterFrame; @@ -1159,36 +1164,37 @@ class TemplateMulti extends ATemplate } } } - + // Mise à jour de la playlist en permanence this._playlistInstance.waitScroll = 0; this._playlistInstance.intervalScroll = 0; this._playlistInstance.scrollMemo = 0; this._playlistInstance.onEnterFrame = this.delegate(this, this.updatePlaylist); - + return true; } /*===================== FIN = METHODES PRIVEES = FIN =====================*/ /*========================================================================*/ - + /*========================== METHODES PUBLIQUES ==========================*/ /*========================================================================*/ /** * Mise à jour de la playlist - * - * @param pAutoScroll Indique qu'il faut scroller au bon endroit de la liste */ + * + * @param pAutoScroll Indique qu'il faut scroller au bon endroit de la liste + */ public function updatePlaylist(pAutoScroll:Boolean) { var text:String = "" var title_tmp:String; var color:String = this._textColor.toString(16); - + if (this.player.playlist.length > 0) { text = ""; } else { text = "Liste vide"; } - + // Génération des pistes for (var i:Number=0; i 0) { // On peut scroller title_tmp += " - "; var textLength:Number = title_tmp.length; - + if (++this._playlistInstance.waitScroll < 40) { this._playlistInstance.intervalScroll = 0; } - + title_tmp = title_tmp.substring(this._playlistInstance.scrollMemo, textLength) + title_tmp.substring(0, this._playlistInstance.scrollMemo - 1); if (++this._playlistInstance.intervalScroll > 5) { this._playlistInstance.scrollMemo += 1; @@ -1229,36 +1235,38 @@ class TemplateMulti extends ATemplate this._playlistInstance.scrollMemo = this._playlistInstance.scrollMemo % (textLength); } this._playlistInstance.textfield_tmp.text = ""; - + // La fin text += title_tmp; text += "\n"; text += ""; text += ""; } - + this._playlistInstance.list_txt.htmlText = text; - + // Scroll automatique sur l'élément if (pAutoScroll && this._playlistInstance.list_txt.maxscroll > 1) { this._playlistInstance.list_txt.scroll = this._playlistInstance.list_txt.maxscroll - (this.player.playlist.length - 1 - this.player.index); } - + // Boutons Previous et Next this._enableButton(this._nextButtonInstance, this.player.hasNext); this._enableButton(this._previousButtonInstance, this.player.hasPrevious); } /** - * Action sur le bouton Previous */ + * Action sur le bouton Previous + */ public function previousRelease() { this.player.previous(); - + this._currentIndex = this.player.index; this.updatePlaylist(true); } /** - * Action sur le bouton Play */ + * Action sur le bouton Play + */ public function playRelease() { super.playRelease(); @@ -1266,26 +1274,28 @@ class TemplateMulti extends ATemplate this._enableButton(this._pauseButtonInstance, true); this._enableButton(this._stopButtonInstance, true); this._sliderInstance.onEnterFrame = this.delegate(this, this._sliderEnterFrame); - + this._currentIndex = this.player.index; - + this._playlistInstance.waitScroll = 0; this._playlistInstance.intervalScroll = 0; this._playlistInstance.scrollMemo = 0; this.updatePlaylist(true); } - /** * Action sur le bouton Pause + /** + * Action sur le bouton Pause */ public function pauseRelease() { super.pauseRelease(); this._enableButton(this._pauseButtonInstance, false, true); this._enableButton(this._playButtonInstance, true); - + this.updatePlaylist(); } /** - * Action sur le bouton Stop */ + * Action sur le bouton Stop + */ public function stopRelease() { super.stopRelease(); @@ -1294,7 +1304,7 @@ class TemplateMulti extends ATemplate this._enableButton(this._playButtonInstance, true); delete this._sliderInstance.onEnterFrame; this._sliderInstance.bar_mc._x = 0; - + this.updatePlaylist(); } /** @@ -1314,13 +1324,13 @@ class TemplateMulti extends ATemplate public function nextRelease() { this.player.next(); - + this._currentIndex = this.player.index; this.updatePlaylist(true); } /** * Modifie le volume - * + * * Le maximum est de 200 * @param pVolume Le nouveau volume */ @@ -1343,4 +1353,4 @@ class TemplateMulti extends ATemplate } /*==================== FIN = METHODES PUBLIQUES = FIN ====================*/ /*========================================================================*/ -} \ No newline at end of file +} diff --git a/template_multi/player_mp3_multi.swf b/template_multi/player_mp3_multi.swf index 846c7b8..b63f136 100644 Binary files a/template_multi/player_mp3_multi.swf and b/template_multi/player_mp3_multi.swf differ