I fixed it.

MovieClip.prototype.centerClip = function (){
        var bounds = this.getBounds(_root);

        //Set faux reg point to (0, 0)
        _xreg = (this._x - bounds.xMin);
        _yreg = (this._y - bounds.yMin);
        
        //center faux registration point to Stage
center
        _xreg += Stage.width - this._width/2;
        _yreg += Stage.height - this._height/2;
        
        //move movieClip to center
        this._x = _xreg;
        this._y = _yreg;
        
        updateAfterEvent();
}

--- Josh Johnston <[EMAIL PROTECTED]> wrote:

> It's my understanding that coordinates are
> calculated
> based on the registration point. So if the
> registration is the top left it would be (0, 0), but
> if the registration point is set to the center, the
> center becomes (0, 0) and the top left is then
> -(mc._width/2, mc._height/2). When you try to center
> a
> movie with the reg point in the upper left you use
> mc._x = Stage.width/2 - mc._width/2;
> mc._y = Stage.height/2 - mc._height/2;
> 
> If the reg point is centered
> mc._x = Stage.width/2;
> mc._y = Stage.height/2;
> 
> is all you need. 
> _x and _y are relative to the registration point.
> 
> Schall's class creates a faux reg point and performs
> scaling, rotation and placement based on the new
> faux
> point, but appends a 2 to each of those properties.
> 
> --- Marc Hoffman <[EMAIL PROTECTED]> wrote:
> 
> > I'm not familiar with Schall's class, but why are
> > you using ._x2, 
> > ._y2 and not just ._x and ._y? For centering
> > purposes, the 
> > registration point shouldn't even matter. -Marc
> > 
> > At 02:15 PM 10/12/2006, you wrote:
> > 
> > >Ok, I've got to be missing something basic here.
> I
> > am
> > >trying to load and center a movieclip to the
> stages
> > >center. I cannot control the registration points
> of
> > >the loaded movie clips so I have tried to make
> use
> > of
> > >Darron Schall's DynamicRegistration class, but
> > >something is awry.
> > >
> > >====================================
> > >_global.loadWrongMovie = function(mc){
> > >   movie_mc = attachMovie(mc, mc+"2", 142);
> > >
> > >   movie_mc.stop();
> > >
> > >   DynamicRegistration.initialize(movie_mc);
> > >
> > >   movie_mc.setRegistration(0, 0);
> > >
> > >   movie_mc._x2 = Stage.width/2 -
> > movie_mc._width/2;
> > >   movie_mc._y2 = Stage.height/2 -
> > movie_mc._height/2;
> > >}
> > 
> > 
> > _______________________________________________
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the
> > archive:
> >
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > 
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the
> archive:
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to