Frame 1
function recupereUnXml(sQuelXml) {
bXmlCharge = false;
mcTitle.field.text = "LOADING-DECRUNCHING";
mcTitle.field.autoSize = "Left";
mcTitle.bAvance = true;
mcAntiClick._visible = true;
var monXml = new XML();
monXml.ignoreWhite = true;
monXml.oNiveau = this;
monXml.onLoad = function (wellDone) {
if (wellDone) {
aMesTracks = [];
if (this.childNodes[0].firstChild != undefined) {
cpt0 = 0;
while (cpt0 < monXml.childNodes.length) {
if (this.childNodes[cpt0].nodeName == "playlist") {
var _local6 = this.childNodes[cpt0];
}
cpt0++;
}
cpt1 = 0;
while (cpt1 < _local6.childNodes.length) {
if (_local6.childNodes[cpt1].nodeName == "trackList") {
trace(_local6.childNodes[cpt1].nodeName);
var _local2 = _local6.childNodes[cpt1];
cpt2 = 0;
while (cpt2 < _local2.childNodes.length) {
if (_local2.childNodes[cpt2].nodeName == "track") {
var _local4;
var _local3;
var _local5;
troisiemeNoeud = _local2.childNodes[cpt2];
cpt3 = 0;
while (cpt3 < troisiemeNoeud.childNodes.length) {
if (troisiemeNoeud.childNodes[cpt3].nodeName == "location") {
_local4 = troisiemeNoeud.childNodes[cpt3].firstChild.nodeValue;
} else if (troisiemeNoeud.childNodes[cpt3].nodeName == "title") {
_local3 = troisiemeNoeud.childNodes[cpt3].firstChild.nodeValue;
} else if (troisiemeNoeud.childNodes[cpt3].nodeName == "creator") {
_local5 = troisiemeNoeud.childNodes[cpt3].firstChild.nodeValue;
}
cpt3++;
}
aMesTracks.push({url:_local4, titre:_local3, artiste:_local5});
}
cpt2++;
}
}
cpt1++;
}
}
if (sMonStyleVoulu == "random") {
aMesTracks.sort(shuffle);
}
mcAntiClick._visible = false;
nIndexTrack = random(aMesTracks.length);
buNext.mcSensitive.onRelease();
bXmlCharge = true;
}
};
monXml.load(sQuelXml);
}
function colorize(mc, sCouleur) {
var _local1 = new Color(mc);
_local1.setRGB(Number("0x" + sCouleur));
}
function calculeLeCycleDeClignottement() {
nTemps++;
if (nTemps > nDureeClignottement) {
if (bClignotte) {
bClignotte = false;
} else {
bClignotte = true;
}
nTemps = 0;
}
}
function jeClignotte(mc, sCouleurA, sCouleurB, bActif) {
if (bActif) {
mc.onEnterFrame = function () {
if (bClignotte) {
colorize(mc, sCouleurA);
} else {
colorize(mc, sCouleurB);
}
};
} else {
delete mc.onEnterFrame;
colorize(mc, sCouleurA);
}
}
function gestionBoutonPlayStopEnCours(mc) {
mcBoutonPlayStopEnCours.mcSensitive.enabled = true;
jeClignotte(mcBoutonPlayStopEnCours.mcSymbolColor, sMaCouleurDeTrais);
jeClignotte(mcBoutonPlayStopEnCours.mcFilledColor, sMaCouleurDeTrais);
mcBoutonPlayStopEnCours = mc;
mcBoutonPlayStopEnCours.mcSensitive.enabled = false;
jeClignotte(mcBoutonPlayStopEnCours.mcSymbolColor, "000000", sMaCouleurDeTrais, true);
jeClignotte(mcBoutonPlayStopEnCours.mcFilledColor, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
}
function initLeCycleDeCouleurDesBarres(mc, nDureeDuCycle) {
mc.nTemps = 0;
mc.nIndex = random(aMaPalette.length);
mc.nDureeDuCycle = nDureeDuCycle;
}
function calculeLeCycleDeCouleurDesBarres(mc) {
mc.nTemps++;
if (mc.nTemps > mc.nDureeDuCycle) {
mc.nIndex++;
if (mc.nIndex > (aMaPalette.length - 1)) {
mc.nIndex = 0;
}
colorize(mc, aMaPalette[mc.nIndex]);
mc.nTemps = 0;
}
}
function afficheLeTitre() {
mcTitle.field.text = (aMesTracks[nIndexTrack].titre.toUpperCase() + " - ") + aMesTracks[nIndexTrack].artiste.toUpperCase();
mcTitle.field.autoSize = "Left";
mcTitle.bAvance = true;
}
function faitBougerLeTitre() {
if ((mcTitle._width > ((mcReferenceBar._x + mcReferenceBar._width) - 60)) && (mcTitle._width < mcReferenceBar._width)) {
mcTitle._x = mcReferenceBar._x + ((mcReferenceBar._width - mcTitle._width) / 2);
} else if (mcTitle.bAvance) {
mcTitle._x = mcTitle._x + 3;
} else {
mcTitle._x = mcTitle._x - 3;
}
if (mcTitle._width < mcReferenceBar._width) {
if (mcTitle._x > (((mcReferenceBar._x + mcReferenceBar._width) - mcTitle._width) - 5)) {
mcTitle.bAvance = false;
}
if (mcTitle._x < (mcReferenceBar._x + 5)) {
mcTitle.bAvance = true;
}
} else {
if (mcTitle._x > (mcReferenceBar._x + 5)) {
mcTitle.bAvance = false;
}
if (mcTitle._x < ((mcReferenceBar._width - mcTitle._width) - 5)) {
mcTitle.bAvance = true;
}
}
}
function joueUnTrack() {
sndMonTrack = new Sound();
sndMonTrack.loadSound(aMesTracks[nIndexTrack].url, true);
sndMonTrack.onSoundComplete = function () {
nDuree = undefined;
buNext.mcSensitive.onRelease();
};
afficheLeTitre();
}
function gereLeLoadingEtLaProgression() {
if (bXmlCharge) {
mcLoadingBar._width = (sndMonTrack.getBytesLoaded() / sndMonTrack.getBytesTotal()) * mcReferenceBar._width;
if (sndMonTrack.getBytesLoaded() == sndMonTrack.getBytesTotal()) {
mcProgressBar._width = (sndMonTrack.getPosition() / sndMonTrack.getDuration()) * mcReferenceBar._width;
} else {
mcProgressBar._width = 0;
}
} else {
mcLoadingBar._width = mcReferenceBar._width;
}
}
function initMzMd() {
var _local3;
_local3 = 0;
while (_local3 < aMesBoutonsDeControl.length) {
var _local4 = aMesBoutonsDeControl[_local3];
_local4.mcSensitive._alpha = 0;
colorize(_local4.mcSymbolColor, sMaCouleurDeTrais);
colorize(_local4.mcFilledColor, sMaCouleurDeTrais);
_local4.mcSensitive.onRollOver = function () {
jeClignotte(this._parent.mcSymbolColor, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
jeClignotte(this._parent.mcFilledColor, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
};
_local4.mcSensitive.onRollOut = function () {
jeClignotte(this._parent.mcSymbolColor, sMaCouleurDeTrais);
jeClignotte(this._parent.mcFilledColor, sMaCouleurDeTrais);
};
_local3++;
}
var _local2;
_local2 = 0;
while (_local2 < aMesStyles.length) {
var _local4 = mcStyleButtons["buStyle" + _local2];
_local4.mcSensitive._alpha = 0;
colorize(_local4.mcSymbolColor, sMaCouleurDeTrais);
colorize(_local4.mcFilledColor, sMaCouleurDeTrais);
_local4.mcSensitive.onRollOver = function () {
jeClignotte(this._parent.mcSymbolColor, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
jeClignotte(this._parent.mcFilledColor, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
this._parent.swapDepths(this._parent._parent.getNextHighestDepth());
};
_local4.mcSensitive.onRollOut = function () {
jeClignotte(this._parent.mcSymbolColor, sMaCouleurDeTrais);
jeClignotte(this._parent.mcFilledColor, sMaCouleurDeTrais);
mcBoutonDeStyleEnCours.swapDepths(this._parent._parent.getNextHighestDepth());
};
_local4.mcSensitive.onRelease = function () {
mcBoutonDeStyleEnCours.mcSensitive.enabled = true;
jeClignotte(mcBoutonDeStyleEnCours.mcSymbolColor, sMaCouleurDeTrais);
jeClignotte(mcBoutonDeStyleEnCours.mcFilledColor, sMaCouleurDeTrais);
mcBoutonDeStyleEnCours = this._parent;
mcBoutonDeStyleEnCours.mcSensitive.enabled = false;
jeClignotte(mcBoutonDeStyleEnCours.mcSymbolColor, "000000", sMaCouleurDeTrais, true);
jeClignotte(mcBoutonDeStyleEnCours.mcFilledColor, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
var _local2 = aMesStyles[this._parent._name.substr(7)];
recupereUnXml(sMonUrlDeBaseDeStyle + _local2);
};
_local2++;
}
mcAntiClick.onRelease = function () {
Void();
};
mcAntiClick.useHandCursor = false;
mcAntiClick._alpha = 0;
mcAntiClick._visible = false;
mcProgressBar._width = 0;
initLeCycleDeCouleurDesBarres(mcProgressBar, 0);
mcLoadingBar._width = 0;
initLeCycleDeCouleurDesBarres(mcLoadingBar, 5);
buPrev.mcSensitive.onRelease = function () {
nIndexTrack--;
if (nIndexTrack < 0) {
nIndexTrack = aMesTracks.length - 1;
}
buPlay.onRelease();
buPlay.mcSensitive.onRelease();
joueUnTrack();
};
buNext.mcSensitive.onRelease = function () {
nIndexTrack++;
if (nIndexTrack >= aMesTracks.length) {
nIndexTrack = 0;
}
buPlay.mcSensitive.onRelease();
joueUnTrack();
};
buStop.mcSensitive.onRelease = function () {
mcTitle.field.text = "PRESS PLAY ON TAPE";
sndMonTrack.stop();
nPosition = sndMonTrack.getPosition();
gestionBoutonPlayStopEnCours(this._parent);
};
buPlay.mcSensitive.onRelease = function () {
afficheLeTitre();
sndMonTrack.start(nPosition / 1000);
gestionBoutonPlayStopEnCours(this._parent);
};
mcTitle.field.text = "";
jeClignotte(mcOnAir, sMaCouleurDeClignottement, sMaCouleurDeTrais, true);
colorize(mcTrais, sMaCouleurDeTrais);
this.onEnterFrame = function () {
faitBougerLeTitre();
gereLeLoadingEtLaProgression();
calculeLeCycleDeClignottement();
calculeLeCycleDeCouleurDesBarres(mcProgressBar);
calculeLeCycleDeCouleurDesBarres(mcLoadingBar);
};
}
function lanceUnePlayliste(str) {
sMonUrlDePlaylist = str;
mcBoutonDeStyleEnCours.mcSensitive.enabled = true;
jeClignotte(mcBoutonDeStyleEnCours.mcSymbolColor, sMaCouleurDeTrais);
jeClignotte(mcBoutonDeStyleEnCours.mcFilledColor, sMaCouleurDeTrais);
recupereUnXml(sMonUrlDePlaylist);
txt.text = str;
}
function shuffle(a, b) {
var _local1 = Math.round(Math.random() * 2) - 1;
return(_local1);
}
ub = "http://www.mazemod.org/tracks/";
db = false;
rev = 244;
System.useCodepage = true;
var sMonUrlDeBaseDeStyle;
var sMonUrlDePlaylist;
var sMaCouleurDeClignottement;
var sMaCouleurDeTrais;
var aMesBoutonsDeControl = [buPrev, buNext, buPlay, buStop, buStyle];
var aMesStyles = ["random", "acid", "bass", "chip"];
var aMesTracks = [];
var nIndexTrack;
var sndMonTrack;
var nPosition;
var nTemps = 0;
var nDureeClignottement = 8;
var bClignotte = true;
var mcBoutonPlayStopEnCours;
var mcBoutonDeStyleEnCours;
var aMaPalette = ["FC5654", "54FE54", "FCFE54", "5456FC", "FC56FC", "54FEFC"];
var bXmlCharge;
if ((cc != undefined) && (cc != "")) {
sMaCouleurDeClignottement = cc;
} else {
sMaCouleurDeClignottement = aMaPalette[2];
}
if ((ct != undefined) && (ct != "")) {
sMaCouleurDeTrais = ct;
} else {
sMaCouleurDeTrais = "FFFFFF";
}
initMzMd();
if ((ub != undefined) && (ub != "")) {
sMonUrlDeBaseDeStyle = ub;
if ((ulst != undefined) && (ulst != "")) {
sMonUrlDePlaylist = ulst;
recupereUnXml(sMonUrlDePlaylist);
} else {
var mcStyleRandom = mcStyleButtons["buStyle" + random(aMesStyles.length)];
mcStyleRandom.mcSensitive.onRelease();
mcStyleRandom.swapDepths(mcStyleRandom._parent.getNextHighestDepth());
}
} else {
mcTitle.field.text = "the XML base url is empty, i can't do anythin' for you... sorry sorry...";
mcTitle.field.autoSize = "Left";
mcTitle.bAvance = true;
mcAntiClick._visible = true;
}
flash.external.ExternalInterface.addCallback("parleAvecFlash", null, lanceUnePlayliste);
if (db == "true") {
dbTxt.text = "mode dedug \u00E0 la porc...";
dbTxt.text = dbTxt.text + ("\n cc:" + cc);
dbTxt.text = dbTxt.text + ("\n ct:" + ct);
dbTxt.text = dbTxt.text + ("\n ub:" + ub);
dbTxt.text = dbTxt.text + ("\n ulst:" + ulst);
} else {
dbTxt._visible = false;
}