Hi
I have this script for loading/zooming in and unloading/zooming out swfs.
Currently the zooming in/out is related to a top left registration point, but
I would like to have the zooming starting from center.
I know that theoretically it is possible to do this, working with an outer and an inner container, centering the inner in the outer, but I couldnt make things really work.
Can somebody give me a little help?
Thanks
//import classes
import mx.transitions.*;
import mx.transitions.easing.*;
loadbar._visible = false;
swfArray = new Array("page 1.swf", "page2.swf", "page3.swf", "page 4.swf" );
var prevCon:MovieClip = this.createEmptyMovieClip("empty", this.getNextHighestDepth());
//mcs to zoom out;
prevCon._x = 270;
prevCon._y = 0;
prevCon.setMask(MASKE);
var n:Number;
//memorize last pressed
function zoomTrans(myPrevClip:MovieClip, myClip:MovieClip) {
zoomOutX = new Tween(myPrevClip, "_xscale", None.easeNone, 100, 0, 1, true);
zoomOutY = new Tween(myPrevClip, "_yscale", None.easeNone, 100, 0, 1, true);
zoomOutY.onMotionFinished = function() {
myPrevClip._alpha = 0;
myClip._alpha = 100;
zoomInX = new Tween(myClip, "_xscale", None.easeNone, 0, 100, .7, true);
zoomInY = new Tween(myClip, "_yscale", None.easeNone, 0, 100, .7, true);
removeMovieClip(myPrevClip);
zoomInY.onMotionFinished = function() {
for (j=1; j<=7; j++) {
_root["btn"+j].enabled = true;
}
//enable buttons
_root["btn"+n].enabled = false;
//but not last pressed
};
};
}
for (var i = 1; i<=7; i++) {
this["btn"+i].ID = i;
this["btn"+i].onRollOver = function() {
this.gotoAndPlay("OVER");
};
this["btn"+i].onRollOut = this["btn"+i].onReleaseOutside=function () {;
this.gotoAndStop("UP");
};
this["btn"+i].onRelease = function() {
//trace(this);
n = this.ID;
for (j=1; j<=7; j++) {
this._parent["btn"+j].enabled = false;
this._parent["btn"+j].gotoAndStop("UP");
}
//disable buttons
var con:MovieClip = this._parent.createEmptyMovieClip("con"+this.ID, this._parent.getNextHighestDepth());
con._x = 270 ;
con._y = 0 ;
con.setMask(MASKE);
con._alpha = 0;
con.loadMovie(swfArray[this.ID-1]);
loadbar._visible = true;
this.onEnterFrame = function() {
var percent:Number = int(Math.round(con.getBytesLoaded()/con.getBytesTotal()*100));
loadbar._xscale = percent;
if (percent>=100) {
//after swf is loaded, do the Tween
loadbar._visible = false;
//trace("prev= "+prevCon);
//trace("con= "+con);
this.gotoAndPlay("HIT");
zoomTrans(prevCon,con);
prevCon = con;
con.setMask(MASKE);
delete this.onEnterFrame;
}
//end if
};
//end onEnterFrame
};
//end onRelease
}
//end for
stop();
btn1.onRelease ();