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
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