# Re: image pan/scale

**URL:** <https://forum.kirupa.com/t/re-image-pan-scale/199035>\
**Category:** Uncategorized\
**Created:** [August 30, 2006, 6:12pm UTC](https://forum.kirupa.com/t/re-image-pan-scale/199035 "2006-08-30T18:12:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![big\_britches](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@big\_britches](https://forum.kirupa.com/u/big_britches)\
**Post date:** [August 30, 2006, 6:12pm UTC](https://forum.kirupa.com/t/re-image-pan-scale/199035/1 "2006-08-30T18:12:23Z")

</div>

Hello all,  
I recently posted an issue I was having in regards to a continuous panning image, with nested buttons triggering a zoom and scale, then subsequent return. It has driven me to the brink of madness…

The site has tentatively gone live, with the as-is version of this flash in place. Since then, I have a more refined version, and am nearly ready to hand over to them. Here’s my issue: the continuous scroll, turned on through setting a variable to true in the root, is refusing to change to false (i.e. stop scrolling) when a button is clicked. Aside from massaging some of the dest\_x’s and dest\_y’s, I think it will be running well…except for this issue. Here’s the main script:

* * *

onClipEvent (enterFrame) {  
trace("zoomstate: "+\_root.zoomstate);  
\_root.scrollmc = true;

```
if (_root.zoomstate == "zoomin") { //zoom the movie clip in
    trace("loop: zooming in");
    //Change x-position
    _root.change_x = _root.panimage._x+_root.dest_x;
    _root.panimage._x = _root.change_x/2;
    //Change y-position
    _root.change_y = _root.panimage._y+_root.dest_y;
    _root.panimage._y = _root.change_y/2;
    //Change scale
    _root.change_scale = _root.panimage._yscale+100;
    _root.panimage._yscale = _root.change_scale/2;
    _root.panimage._xscale = _root.change_scale/2;
    //Output x/y position
    trace("xpos = "+_root.panimage._x);
    trace("ypos = "+_root.panimage._y);
    if ((_root.panimage._x/_root.dest_x)&gt;0.99) { //If close enough to dest_x, escape loop
        _root.panimage._x = _root.dest_x;
        _root.panimage._y = _root.dest_y;
        _root.panimage._yscale = 100;
        _root.panimage._xscale = 100;
        _root.zoomstate = "zoomedin";
        trace("zoomstate: "+_root.zoomstate);  
        trace("currentscene: "+_root.currentscene); 
        _root.overlay.gotoAndPlay(_root.currentscene);

    }
} else if (_root.zoomstate == "zoomout") { //zoom the movie clip out
    trace("loop: zooming out");
    //Change x-position
    _root.dest_x = _root.orig_x;
    _root.change_x = _root.panimage._x+_root.dest_x;
    _root.panimage._x = _root.change_x/2;
    //Change y-position
    _root.dest_y = _root.orig_y;
    _root.change_y = _root.panimage._y+_root.dest_y;
    _root.panimage._y = _root.change_y/2;
    //Change scale
    _root.change_scale = _root.panimage._yscale+50;
    _root.panimage._yscale = _root.change_scale/2;
    _root.panimage._xscale = _root.change_scale/2;
    if ((_root.panimage._x/_root.dest_x)&gt;0.99) { //If close enough to dest_x, escape loop
        _root.panimage._x = _root.dest_x;
        _root.panimage._y = _root.dest_y;
        _root.panimage._yscale = 50;
        _root.panimage._xscale = 50;
        _root.zoomstate = "zoomedout";
        trace("zoomstate: "+_root.zoomstate);
        //turn scrolling back on
    }
}

//controll scrolling
trace("scroll= " + _root.scrollmc);
if (_root.scrollmc == true) {
    //start scrolling
        _root.panimage._x = _root.panimage._x+1;
        //when mouse moves left, navigation panel moves right
        if ((_xmouse&gt;30) && (_xmouse&lt;238) && (_ymouse&gt;-255) && (_ymouse&lt;-75)) {
            _root.panimage._x = _root.panimage._x+3;
        }
        //when mouse moves right, navigation panel moves left
        if ((_xmouse&gt;398) && (_xmouse&lt;616) && (_ymouse&gt;-255) && (_ymouse&lt;-75)) {
            _root.panimage._x = _root.panimage._x-6;
        }
        //when navigation panel reaches it's maximum x-value it resets itself
        if (_root.panimage._x&gt;0) {
            _root.panimage._x = -1486;
        }
        if (_root.panimage._x&lt;-1540) {
            _root.panimage._x = -52;
        }
}

```

}

* * *

## And here’s a sample of one of the button scripts:

on(press, release) {  
\_root.scrollmc = false;  
\_root.dest\_x = 300;  
\_root.orig\_x = \_root.panimage.\_x;  
\_root.dest\_y = -40;  
\_root.orig\_y = \_root.panimage.\_y;  
\_root.zoomstate = “zoomin”;  
\_root.currentscene = “phone-start”;  
}

* * *

## I’m also afraid that the escape conditional on the ‘zoom out’ state is jacked up:

if ((\_root.panimage.\_x/\_root.dest\_x)\>0.99) { //If close enough to dest\_x, escape loop

* * *

but my major issue is how to stop the scroll during scale/shift, then restart it when scaled back out. Any help from any experts would be so incredibly welcome, andI would be forever grateful. Krilnon was originally helping me with this; Krilnon - if you’d like, take a look and tell me your ideas. The live version is at:

[http://www.noscamnc.gov](http://www.noscamnc.gov)

That is the older, now-live version. Here’s an internal link to the new version, so you can see both the progress and the errors:

[http://dev2.capstrat.com/clients/doj](http://dev2.capstrat.com/clients/doj)

I’m panicked for time - this is making me crazy. Thanks again!
