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!

center / printing

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(){
dragListX = this._x;
dragListY = _root.list_mc._y;
}
_root.viewport_mc.onMouseUp = function(){
_root.list_mc._visible = false;

//move list_mc back to the center of the screen
_root.list_mc._x = dragListX;
_root.list_mc._y = dragListY;

//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. The problem that I am having deals with printing. I do not know where to start the printing at. I cannot start at niewport_mc._x/y since that value is the center of the screen, not the resulting elements in the viewport. What about looping through all the elements in the viewport whenever the print command is called:


i.e.
var Xpos = 10000;
Var Ypos = 10000;
For (var mc in _root.viewport_mc) {
if (_root.viewport_mc._x < Xpos) {
Xpos = _root.viewport_mc._x;
}
if (_root.viewport_mc._y < Ypos) {
Ypos = _root.viewport_mc._y;
}
}

I haven't tried it, but I don't think that this is the route that I should go...I would be very grateful for some help on this because I am sort of new to flash and especially the whole viewport inside of a window thing...

Thank you -
Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top