flash actionscript:
Please can anyone with advanced knowledge of Actionscript please help me with
my code (shown below) in respect to a requirement for zooming?
I'm creating a flash animation in which I'd like to 'zoom' in and out of a
movie clip when the mouse is held. I only want to zoom into the movieclip if
the mouse is being held down and if released the movie should zoom back out.
I'm using someone else's code (shown below) which gives me the ability to zoom
into a point where the cursor is clicked. If the mouse is clicked a second time
it returns back to original resolution. The code uses onClipEvent (mouseDown)
rather than this.hitTest to ensure the zoom goes to the area the cursor is
positioned.
Is it possible to adapt this code so rather than just zooming to a set
magnification and stopping, it zooms only if the mouse is held down, and
returns to original resolution on the mouse is released?
The .fla for the code I am using is at:
[url]
http://www.flashkit.com/movies/Effects/Other/Auto_zoo-T_Norman-6578/index.p hp[/url]
many thanks in advance..
actions assigned to cursor:
*/note:
"zoom_this" is the instance name for the movie being zoomed.)*/
onClipEvent (mouseDown) {
if (i>0) {
return;
}
zoom = true;
dir == 1 ? (dir=-1) : (dir=1);
if (dir == 1) {
pt = {x:_root.zoom_this._xmouse, y:_root.zoom_this._ymouse};
}
onClipEvent (enterFrame) {
if (!zoom) {
return;
}
_root.zoom_this._xscale += dir*i*100/8;
_root.zoom_this._yscale += dir*i*100/8;
var pt2 = {x:pt.x, y:pt.y};
_root.zoom_this.localToGlobal(pt2);
_root.zoom_this._x -= (pt2.x-pt.x);
_root.zoom_this._y -= (pt2.y-pt.y);
i++;
if (i == 10) {
zoom = false;
i = 0;
}
}
Thanks
[URL=
http://www.xstasis.net/]xstasis[/URL]