Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

registration point

Status
Not open for further replies.

cruise95

Programmer
Oct 7, 2003
56
US
Hello,

I have a viewport inside of _root.mc. This viewport also contains other movieclips. So the structure is:
_root.viewport_mc.element_mc1
_root.viewport_mc.element_mc2
...
_root.viewport_mc.element_mcn


I am trying to make a viewport effect like you see in VISIO. I've included the ability to drag/drop the viewport as well as drag/drop particular elements). I also added the ability to zoom (scale) in and out. I wanted to make the zooming occur in the middle of the screen each time. To accomplish this I started out with the registration point being in the center of the screen and then I did this:


_root.viewport_mc.onMouseDown = function(){
dragViewportX = _root.viewport_mc._x;
dragViewportY = _root.viewport_mc._y;
}
_root.viewport_mc.onMouseUp = function(){
_root.viewport_mc._visible = false;

//move list_mc back to the center of the screen
_root.viewport_mc._x = dragViewportX;
_root.viewport_mc._y = dragViewportY;

//now move all elements to the correct position
//based on the deltas
for(var mc in _root.viewport_mc) {
_root.viewport_mc[mc]._x += deltaX;
_root.viewport_mc[mc]._y += deltaY;
}
viewport_mc._visible = true;
}

This assures that the registration point is always in the center. This solution does not look good since, the user still sees this movement. Is there anyway that I can just move the registration point without having to move the viewport_mc and each element_mc contained within the viewport_mc?

Thank you for any help/suggestions -
Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top