Groups | Blog | Home
all groups > flash actionscript > june 2005 >

flash actionscript : Centering External JPG in Movie Clip


WebIslands
6/22/2005 9:38:52 PM
Hello All,

I have created an SWF, and place a MC on it. I then loaded an External JPG
into the movie clip. The JPG Loads fine, except the center of the JPG loads to
the bottom right corner of the MC. I know this because I move the center of the
MC to the Top Right corner and it looked great. How can I Center a JPG to the
Center of a MC.

Thanks
~Chris
NSurveyor
6/22/2005 10:00:14 PM
In order to move the JPG, without shifiting the rest of the content, you need
to load it into another movieclip that is in MCBox1. Then once its loaded, you
can move that new movieclip so that it is centered in MCBox1.

MCBox1.createEmptyMovieClip('image_holder',1);
MCBox1.onEnterFrame = function(){
if(this.image_holder._width){
this.image_holder._x = -this.image_holder._width/2;
this.image_holder._y = -this.image_holder._height/2;
delete onEnterFrame;
}
}
MCBox1.image_holder.loadMovie("wd_a.jpg");

WebIslands
6/23/2005 12:00:00 AM
Thanks... It worked

Maybe you can help with another problem... Here is the link to the question

NSurveyor
6/24/2005 12:16:16 AM
AddThis Social Bookmark Button