-
Need to Zoom Movieclip
Hi,
I have a map image inside a movieclip that is located in the first frame of the main timeline. I've been trying to use the code below (created by NTD) to zoom the movieclip, but it zooms the entire movie. I've changed _root to _root.map (map is the movieclip instance name), and I've tried putting the code everywhere. I can get only two results. Either the entire movie zooms or nothing zooms. Can this code be modified to work on a mc?
BTW, what would be almost like Christmas would be for the code below to zoom to each of the three choices. In other words, for the image to get larger on each mouse click and keep the clicked point as the center. But that would just be asking too much. I'd be tickled to death just to get it to apply only to my movieclip.
Thanks a bunch,
Debbie
Code:
scale = false;
myZoom = function (myDepth) {
if (myDepth == "deep") {
myDepth = 4;
} else if (myDepth == "medium") {
myDepth = 8;
} else if (myDepth == "light") {
// default
myDepth = 12;
}
_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};
scale = true;
}
if (dir == -1) {
scale = false;
}
}
_root.onMouseUp = function() {
if (k>0) {
return;
zoom = false;
}
dir == 1 ? (dir=-1) : (dir=1);
zoom = true;
}
_root.onEnterFrame = function() {
if (!zoom) {
return;
}
_root._xscale += dir*k*50/myDepth;
_root._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;
}
}
}
//Usage
myZoom("medium");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|