// [url]www.biffbang.de[/url] // FLYERCASE by Paul Holland - [email]paul.holland@web.de[/email] - (c)2007
//
// F L Y E R C A S E Version 1.0
// - improoved DIA-Script -
//
// GLOBAL SETTINGS
//
Object.registerClass("DIAdz", DIA);
_global.getDiasLoaded = 0;
_global.getDiaStatus = "ready";
_global.POSITION = 0;
//
info = new XML();
info.ignoreWhite = true;
info.contentType = "text/xml";
info.load(["---/flyer/info.xml"]);
info.onLoad = function(success) {
infoXML = info.firstChild;
if (success) {
_root.info_txt.text = "";
showHead();
} else {
_root.info_txt.text = "Die Datei 'info.xml' konnte nicht geladen werden.";
}
};
function showHead() {
trace(infoXML.nodeName+" "+infoXML.attributes.domain);
trace("");
trace("Script: "+infoXML.attributes.script);
trace("Author: "+infoXML.attributes.author);
trace("");
Settings();
}
function Settings() {
Set = [];
for (var i = 0; i<infoXML.childNodes[1].childNodes.length; i++) {
Set[i] = infoXML.childNodes[1].childNodes[i].attributes.value;
}
_global.AUSWAHLFARBE = "0x"+Set[0];
_global.TIMEOUT = Math.abs(Set[1]);
_global.FADETIME = Math.abs(Set[2]);
_global.ROTATION = Math.abs(Set[3]);
//
infoXML.childNodes[0].removeNode();
//
_global.DIAANZAHL = Math.abs(infoXML.childNodes.length)-1;
trace("DIAS: "+DIAANZAHL);
//
_root.DROPDOWN();
}
//
//
//
DROPDOWN = function () {
var i = 1;
var a = 0;
this.onEnterFrame = function() {
a++;
if (i<=DIAANZAHL && getDiaStatus == "ready" && a>=16) {
_root.attachMovie("DIAdz", ["dz"+i+"_mc"], i);
_root["dz"+i+"_mc"].init(i);
i++;
_global.getDiaStatus = "loading";
} else if (i>=DIAANZAHL) {
delete this.onEnterFrame;
}
};
};
//
//
DIA = function () {
};
DIA.prototype = new MovieClip();
DIA.prototype.init = function(nr) {
this._alpha = 0;
this.nr = nr;
this.ok = false;
// Dateiname
this.path = ["---/flyer/"+infoXML.childNodes[this.nr].childNodes[0].attributes.value];
// Link
this.link = infoXML.childNodes[this.nr].childNodes[1].attributes.value;
//
trace("");
trace("Flyer"+this.nr+": "+this.path);
trace("Link: "+this.link);
this.load();
};
DIA.prototype.load = function() {
this.loadingdelay = 0;
this.dz.loadMovie(this.path);
this.onEnterFrame = function() {
this.bt = this.dz.getBytesTotal();
this.bl = this.dz.getBytesLoaded();
this.p = this.bl*100/this.bt;
// anzeige
_root.load_txt.text = "Lädt... [ Flyer"+this.nr+": "+this.bt+"|"+this.bl+" ]";
if (this.p>=90) {
delete this.onEnterFrame;
_root.load_txt.text = this.nr+"";
this.loadOK();
_global.getDiasLoaded++;
_global.getDiaStatus = "ready";
//
} else if (this.bt == -1) {
this.loadingdelay++;
if (this.loadingdelay>=16) {
delete this.onEnterFrame;
_root.info_txt.text = "Error... [ Flyer"+this.nr+" konnte nicht geladen werden. ]";
this.loadOK();
_global.getDiasLoaded++;
_global.getDiaStatus = "ready";
}
}
};
};
D;
DIA.prototype.loadOK = function() {
this.positionXY();
this.ok = true;
_root.info_txt.text = "Nummer: "+this.nr+" "+this.ok
};
DIA.prototype.positionXY = function() {
// Position
this.onEnterFrame = function() {
if (this.dz._width>=32) {
delete this.onEnterFrame;
this._x = Stage.width/2;
this._y = Stage.width/2;
this.dz._x -= this.dz._width/2;
this.dz._y -= this.dz._height/2;
//
this.swapDepths(10+this.nr);
this._xscale = 0;
this._yscale = 0;
//
this.aktion();
this.timeout((this.nr-1)*(TIMEOUT+1));
}
};
};
DIA.prototype.timeout = function(epos) {
this.e = epos;
this.getMyStart = ((TIMEOUT*this.nr)-TIMEOUT);
this.getMyEnd = (TIMEOUT*this.nr);
if (this.getMyEnd == TIMEOUT*DIAANZAHL) {
this.getMyEnd = 0;
}
this.getNextNr = ((this.getMyEnd/TIMEOUT)+1);
// Counter
this.onEnterFrame = function() {
if (this.e == 0) {
this.fadein();
} else if (this.e == TIMEOUT) {
this.fadeout();
POSITION = this.getMyEnd;
}
this.e++;
};
};
DIA.prototype.fadein = function() {
var fade = 100/FADETIME;
var rotate = ROTATION/FADETIME;
var i = 0;
this.onEnterFrame = function() {
if (i<=FADETIME) {
i++;
this._xscale = fade*i;
this._yscale = fade*i;
this._alpha = fade*i;
this._rotation = rotate*i-rotate;
} else {
this.swapDepths(30+this.nr);
this.timeout(FADETIME);
}
};
};
DIA.prototype.fadeout = function() {
var fade = 100/FADETIME;
var rotate = ROTATION/FADETIME;
var i = FADETIME;
var n = 0;
this.onEnterFrame = function() {
var key = _root["dz"+this.getNextNr+"_mc"].ok;
if (n == 0 && key == true) {
_root["dz"+this.getNextNr+"_mc"].e = 0;
n++;
}
if (i>=0 && key == true) {
i--;
this._xscale = fade*i;
this._yscale = fade*i;
this._alpha = fade*i;
this._rotation = rotate*i-rotate;
} else if (key == true) {
this.swapDepths(10+this.nr);
this.timeout(TIMEOUT+1);
}
};
};
DIA.prototype.aktion = function() {
//this.onRollOver = this.rollover;
//this.onRollOut = this.rollout;
this.onRelease = this.popup;
};
DIA.prototype.popup = function() {
getURL(this.link, "_top");
};
Stage.scaleMode = noScale;
_root.info_txt._x = 0;
_root.info_txt._y = 10;
_root.load_txt._x = 0;
_root.load_txt._y = Stage.height-load_txt._height-10;
Object.registerClass("DIAdz", DIA);