A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Zoom map scirpt (can anyone help)

  1. #1
    Member
    Join Date
    Jan 2002
    Posts
    95

    Zoom map scirpt (can anyone help)

    I Have made a map which you can zoom into but I have got the actionsript off a magazine which controls the amount of zoom. I would like to make it half of what it zooms in at but have no idea how to change it.

    I realise that I should post what the problem is and try to work through it but I'm not sure how it works.

    So I have attached the file if anyone could help that would be great.

    The file is a flash 5
    Attached Files Attached Files
    heath

  2. #2
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    It appears this code has gotten around some... thanks to ericlin

    http://www.flashkit.com/movies/Effec...6578/index.php

    The lines of code you would need to affect to change the scale of the zoom is this....

    _root.zoom_this._xscale += dir*i*100/8;
    _root.zoom_this._yscale += dir*i*100/8;

    The only thing you need to change is the scale divisor at the end of those lines.....

    _root.zoom_this._xscale += dir*i*100/50;
    _root.zoom_this._yscale += dir*i*100/50;


    Have to play around with it some to get what you want. You can also change the code from a clip event to frame code so it is easier to manipulate like this......

    frame 1..

    code:

    _root.onMouseDown = function() {
    if (k>0) {
    return;
    }
    zoom = true;
    dir == 1 ? (dir=-1) : (dir=1);
    if (dir == 1) {
    pt = {x:_root._xmouse, y:_root._ymouse};
    }
    }
    _root.onEnterFrame = function() {
    if (!zoom) {
    return;
    }
    _root._xscale += dir*k*50/8;
    _root._yscale += dir*k*50/8;
    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;
    }
    }



    This could also be applied to individual MC's.......

    code:

    _root.mcName.onMouseDown = function() {
    if (k>0) {
    return;
    }
    zoom = true;
    dir == 1 ? (dir=-1) : (dir=1);
    if (dir == 1) {
    pt = {x:_root._xmouse, y:_root._ymouse};
    }
    }
    _root.mcName.onEnterFrame = function() {
    if (!zoom) {
    return;
    }
    _root._xscale += dir*k*50/8;
    _root._yscale += dir*k*50/8;
    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;
    }
    }







    HTH
    NTD
    Last edited by NTD; 05-20-2004 at 09:47 PM.

  3. #3
    Member
    Join Date
    Jan 2002
    Posts
    95

    code

    Thanks very much for the advice worked a treat.

    cheers.
    heath

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