need help adjusting ntd's zoom code to my needs
hi!
i went through threads about this awesome piece of script, but didn't find an answer to my problem. i have to confess that this script is waaaayyyy too much for my nearly-beginner as skills, and so i don't understand the crucial bits...
what i wish to do is
1) to have this script in an externally loaded swf
2) have it zoom just once the main/background movie to a precisely defined center point and stay there
3) when unloading the external swf i want to zoom the background/main movie back to it's original dimensions.
now the two first issues i have been able to somehow crack - it may not be pretty, but it works - but it is the third issue that i most need guidance with. i can't get my background swf to zoom out back to normal size upon external swf unload.
i'll paste the code here in its original form, with a few explanations telling how i've modified it for my need.
Code:
/*
/*
Auto Zoom Function
T. Norman
http://ntdesigns.net
*/
k=0
myZoom = function (myDepth) {
if (myDepth == "deep") {
myDepth = 4;
} else if (myDepth == "medium") {
myDepth = 8;
} else if (myDepth == "light") {
// default
myDepth = 12;
}
trace(myDepth);
myTween=new mx.transitions.Tween(myExternalSwf, "_xscale", easeType, 0, 100, 5); //this replaces the on mouse click function for me
myTween.onMotionFinished=function(){
if (k>0) {
return;
}
zoom = true;
dir == 1 ? (dir=-1) : (dir=1);
if (dir == 1) {
pt = {x:-200, y:-27};// this i'm using instead of pt = {x:_root._xmouse, y:_root._ymouse};
}
}
this.onEnterFrame = function() {
if (!zoom) {
return;
}
_root.myBgMovie._xscale += dir*k*50/myDepth; //adjustments here to zoom my background movie and not the external swf
_root.myBgMovie._yscale += dir*k*50/myDepth;
var pt2 = {x:pt.x, y:pt.y};
_root.localToGlobal(pt2);
_root._x -= (pt2.x-pt.x);
_root._y -= (pt2.y-pt.y);
k++;
if (k == 8) {
zoom = false;
k = 0;
}
}
}
myZoom("medium");
...and then i've tried different things with this.onUnload=function(){ bg.zoombacksomehow } but i'm nowhere near the solution.
pleeeeeeease help! i also tried to find this code explained, but didn't... i really need to have this zoom working in my site. i'll be grateful forever...