Actually, this will break the NS resize fix.

What you want is:

function CenterLayer(theLayer){
 var x = DynAPI.document.getWidth()/2-theLayer.getWidth()/2;
 var y = DynAPI.document.getHeight()/2-theLayer.getHeight()/2;
 theLayer.moveTo(x,y);
}

DynAPI.addResizeFunction("CenterLayer(yourLayer)");

> Hi, try this:
> 
> DynAPI.onResize=function() {
> var x = DynAPI.document.getWidth()/2-yourLayer.getWidth()/2;
> var y = DynAPI.document.getHeight()/2-yourLayer.getHeight()/2;
> yourLayer.moveTo(x,y);
> }
> 
> /martin
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED]] On Behalf Of 
> > Chun Wah Chan
> > Sent: den 15 november 2001 15:10
> > To: [EMAIL PROTECTED]
> > Subject: [Dynapi-Help] keep layer center when resize!
> > 
> > 
> > Hi all:
> > 
> > I've made a layer center to the DynAPI.document layer
> > by using one of the tutorial on the web, however, it
> > doesn't center when I tried to resize the window?
> > 
> > I notice that there is a addEventListener method for
> > the DynDocument object, but do I really need to add an
> > eventListener to the DybDocument if I need to center a
> > layer in it?  or i can modify some code in the
> > Dyndocument object?
> > 
> > Thanks in advance!
> > 
> > Herman
> > 
> > _______________________________________________________
> > Build your own website in minutes and for free at 
> > http://ca.geocities.com
> > 
> > 
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/dynapi-help
> > 
> 
> 
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
> 


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to