Centering the registration point in pure as3


hi

 

is there way centre or matter change registration point of dynamically loaded movieclip.

 

it pretty simple on stage, in pure as3, there seems no obvious way.

 

thanks

you can use changeregpt change registration point of displayobject:

 

changeregpt(mc,mc.width/2,mc.height/2);

 

function changeregpt(dobj:displayobjectcontainer,x:number,y:number){

    var r:rectangle = dobj.getbounds(dobj);

    for(var i:uint=0;i<dobj.numchildren;i++){

        dobj.getchildat(i).x -= r.x+x;

        dobj.getchildat(i).y -= r.y+y;

    }

    dobj.x += r.x+x;

    dobj.y += r.y+y;

}



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support