codice:
function init(Void):Void {
for (var i in infostruc) {
loader.gradient_mc.removeMovieClip();
loader.attachMovie("default", "art", 1);
this["_bmd"+i] = new BitmapData(loader._width, loader._height);
this["_ref"+i] = new BitmapData(loader._width, loader._height);
this["_bmd"+i].draw(loader);
var mc:MovieClip = loader.createEmptyMovieClip("gradient_mc", loader.getNextHighestDepth());
matrix = new Matrix();
matrix.createGradientBox(loader._width, loader._height, reflectionRotation/180*Math.PI, 0, 0);
mc.beginGradientFill(reflectionFillType, reflectionColors, reflectionAlphas, reflectionRatios, matrix, reflectionSpreadMethod, reflectionInterpolationMethod, reflectionFocalPointRatio);
mc.moveTo(0, 0);
mc.lineTo(0, loader._height);
mc.lineTo(loader._width, loader._height);
mc.lineTo(loader._width, 0);
mc.lineTo(0, 0);
mc.endFill();
this["_ref"+i].draw(loader);
}
for (var i:Number = count=0; count<Stage.width-(centerDistance*2); count += shelveCDSpacing, i++) {
var cArt:MovieClip = this.createEmptyMovieClip("art"+this.getNextHighestDepth(), this.getNextHighestDepth());
var rArt:MovieClip = this.createEmptyMovieClip("reflection"+(this.getNextHighestDepth()-1), this.getNextHighestDepth());
rArt.id = cArt.id=rArt.cid=cArt.cid=Number(i)+1;
cArt.DistortImage(this["_bmd"+cArt.id]);
controlTheObject(cArt);
rArt.DistortImage(this["_ref"+cArt.id]);
controlTheObject(rArt);
tmask = mask.duplicateMovieClip("_mask"+cArt.id, this.getNextHighestDepth(), {_x:mask._x, _y:mask._y});
rmask = mask.duplicateMovieClip("_rmask"+cArt.id, this.getNextHighestDepth(), {_x:mask._x, _y:mask._y});
cArt.setMask(tmask);
rArt.setMask(rmask);
}
distance = Number(i);
mask.removeMovieClip();
fscreen.swapDepths(1102);
loader.removeMovieClip();
loadNext();
updateInfo();
}
function concat(m1, m2):Object {
var mat = {};
mat.a = m1.c*m2.b;
mat.b = m1.d*m2.b;
mat.c = m1.a*m2.c;
mat.d = m1.b*m2.c;
mat.tx = m1.a*m2.tx+m1.c*m2.ty+m1.tx;
mat.ty = m1.b*m2.tx+m1.d*m2.ty+m1.ty;
return mat;
}
function updateInfo():Void {
info = infostruc[current-1].info;
author = infostruc[current-1].auth;
displayAlternArt(infostruc[current-1].art, artDisplay._width-1, artDisplay._height-1);
scrollBar.scroller._x = scrollBarStart+((current-1)/(infostruc.length-1)*(scrollBar._width-scrollBarStop));
}
function validateOk(target:MovieClip):Boolean {
return Math.abs(Math.min(Math.max((target._x-target.x)/albumEase, -maxSlide), maxSlide)) == maxSlide;
}
function controlTheObject(mc):Void {
if (mc._name.indexOf("reflection") == -1) {
mc.onPress = function():Void {
if (getTimer()-this.pressTime<=doubleClickRegister && this.pressTime) {
/// Things to come...
}
this.pressTime = getTimer();
current = this.cid+1;
updateInfo();
};
}
mc.onEnterFrame = function():Void {
if (Math.abs(this._x-this.x)>1) {
if (this._name.indexOf("reflection") == -1) {
this._y = centerY;
if (this._x>=centerX+centerDistance) {
this.swapDepths(Stage.width-this._x);
this.setSides(-(shelveCDWidth/2), -(shelveCDHeight/2)+((Math.sin(angle*Math.PI/180)*frontCDWidth)), -(shelveCDWidth/2)+shelveCDWidth, -(shelveCDHeight/2), -(shelveCDWidth/2)+shelveCDWidth, shelveCDHeight/2, -(shelveCDWidth/2), (shelveCDHeight/2)-((Math.sin(angle*Math.PI/180)*frontCDWidth)));
} else if (this._x<=centerX-centerDistance) {
this.swapDepths(this._x);
this.setSides(-(shelveCDWidth/2), -(shelveCDHeight/2), -(shelveCDWidth/2)+shelveCDWidth, -(shelveCDHeight/2)+(Math.sin(angle*Math.PI/180)*frontCDWidth), -(shelveCDWidth/2)+shelveCDWidth, (shelveCDHeight/2)-(Math.sin(angle*Math.PI/180)*frontCDWidth), -(shelveCDWidth/2), shelveCDHeight/2);
} else if (this._x>centerX-centerDistance && Math.floor(this._x)<centerX && !validateOk(this)) {
this.swapDepths(1002);
var sum:Number = shelveCDWidth+((this._x-(centerX-centerDistance))/centerDistance*(frontCDWidth-shelveCDWidth));
var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
var sum3:Number = shelveCDHeight+((this._x-(centerX-centerDistance))/centerDistance*(frontCDHeight-shelveCDHeight));
this.setSides(-(sum/2), -(sum3/2), -(sum/2)+sum, -(sum3/2)+((Math.sin(sum2*Math.PI/180)*frontCDWidth)), -(sum/2)+sum, (sum3/2)-((Math.sin(sum2*Math.PI/180)*frontCDWidth)), -(sum/2), sum3/2);
} else if (this._x<centerX+centerDistance && Math.ceil(this._x)>centerX && !validateOk(this)) {
this.swapDepths(1003);
var sum:Number = shelveCDWidth+(((centerX+centerDistance)-this._x)/centerDistance*(frontCDWidth-shelveCDWidth));
var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
var sum3:Number = shelveCDHeight+(((centerX+centerDistance)-this._x)/centerDistance*(frontCDHeight-shelveCDHeight));
this.setSides(-(sum/2), -(sum3/2)+((Math.sin(sum2*Math.PI/180)*frontCDWidth)), -(sum/2)+sum, -(sum3/2), -(sum/2)+sum, sum3/2, -(sum/2), (sum3/2)-((Math.sin(sum2*Math.PI/180)*frontCDWidth)));
} else if (!validateOk(this)) {
this.setSides(-(frontCDWidth/2), -(frontCDHeight/2), -(frontCDWidth/2)+frontCDWidth, -(frontCDHeight/2), -(frontCDWidth/2)+frontCDWidth, frontCDHeight/2, -(frontCDWidth/2), frontCDHeight/2);
}
} else {
this._yscale = -100;
if (this._x>=centerX+centerDistance) {
this._y = centerY+shelveCDHeight+reflectionSpace;
this.swapDepths(-(Stage.width-this._x));
this.setSides(-(shelveCDWidth/2), -(shelveCDHeight/2)+(Math.sin(angle*Math.PI/180)*frontCDWidth), -(shelveCDWidth/2)+shelveCDWidth, -(shelveCDHeight/2), -(shelveCDWidth/2)+shelveCDWidth, shelveCDHeight/2, -(shelveCDWidth/2), (shelveCDHeight/2)+((Math.sin(angle*Math.PI/180)*frontCDWidth)));
} else if (this._x<=centerX-centerDistance) {
this._y = centerY+shelveCDHeight+reflectionSpace;
this.swapDepths(-(this._x+333));
this.setSides(-(shelveCDWidth/2), -(shelveCDHeight/2), -(shelveCDWidth/2)+shelveCDWidth, -(shelveCDHeight/2)+((Math.sin(angle*Math.PI/180)*frontCDWidth)), -(shelveCDWidth/2)+shelveCDWidth, (shelveCDHeight/2)+(Math.sin(angle*Math.PI/180)*frontCDWidth), -(shelveCDWidth/2), shelveCDHeight/2);
} else if (this._x>centerX-centerDistance && this._x<centerX && !validateOk(this)) {
this.swapDepths(1004);
var sum:Number = shelveCDWidth+((this._x-(centerX-centerDistance))/centerDistance*(frontCDWidth-shelveCDWidth));
var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
var sum3:Number = shelveCDHeight+((this._x-(centerX-centerDistance))/centerDistance*(frontCDHeight-shelveCDHeight));
this._y = centerY+sum3+reflectionSpace;
this.setSides(-(sum/2), -(sum3/2), -(sum/2)+sum, -(sum3/2)+((Math.sin(sum2*Math.PI/180)*frontCDWidth)), -(sum/2)+sum, (sum3/2)+((Math.sin(sum2*Math.PI/180)*frontCDWidth)), -(sum/2), sum3/2);
} else if (this._x<centerX+centerDistance && this._x>centerX && !validateOk(this)) {
this.swapDepths(1005);
var sum:Number = shelveCDWidth+(((centerX+centerDistance)-this._x)/centerDistance*(frontCDWidth-shelveCDWidth));
var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
var sum3:Number = shelveCDHeight+(((centerX+centerDistance)-this._x)/centerDistance*(frontCDHeight-shelveCDHeight));
this.setSides(-(sum/2), -(sum3/2)+((Math.sin(sum2*Math.PI/180)*frontCDWidth)), -(sum/2)+sum, -(sum3/2), -(sum/2)+sum, sum3/2, -(sum/2), (sum3/2)+((Math.sin(sum2*Math.PI/180)*frontCDWidth)));
this._y = centerY+sum3+reflectionSpace;
} else if (!validateOk(this)) {
this._y = centerY+frontCDHeight+reflectionSpace;
this.setSides(-(frontCDWidth/2), -(frontCDHeight/2), -(frontCDWidth/2)+frontCDWidth, -(frontCDHeight/2), -(frontCDWidth/2)+frontCDWidth, frontCDHeight/2, -(frontCDWidth/2), frontCDHeight/2);
}
}
}
this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
if (this._x<deleteMinDistance && this._parent["_ref"+(this.cid+distance)]) {
this.cid += distance;
this._x = deleteMaxDistance;
controlTheObject(this);
}
if (this._x>deleteMaxDistance && this._parent["_ref"+(this.cid-distance)]) {
this.cid -= distance;
this._x = deleteMinDistance;
controlTheObject(this);
}
if (this.cid+1>current) {
this.x = (centerX+((this.cid+1-current)*shelveCDSpacing))+centerDistance;
} else if (this.cid+1<current) {
this.x = (centerX+((this.cid+1-current)*shelveCDSpacing))-centerDistance;
} else {
this.x = centerX+((this.cid+1-current)*shelveCDSpacing);
}
this._x -= Math.min(Math.max((this._x-this.x)/albumEase, -maxSlide), maxSlide);
if (this._x<fadeDist) {
this._alpha = (this._x/fadeDist*100)-(this._name.indexOf("reflection")>-1 ? reflectionAlpha : 0);
} else if (this._x>fadePoint-fadeDist) {
this._alpha = ((fadePoint-this._x)/fadeDist*100)-(this._name.indexOf("reflection")>-1 ? reflectionAlpha : 0);
} else {
this._alpha = 100-(this._name.indexOf("reflection")>-1 ? reflectionAlpha : 0);
}
this.setTransform(this.px1, this.py1, this.px2, this.py2, this.px3, this.py3, this.px4, this.py4);
};
... continua e finisce...