A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: need help adjusting ntd's zoom code to my needs

  1. #1
    user in A minor
    Join Date
    Jan 2005
    Location
    finland
    Posts
    121

    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...
    Last edited by mrk13; 10-16-2006 at 11:19 AM. Reason: error in pasting code... this one is correct

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center