Tuesday, March 30, 2010

Fill a Movieclip with an Image

Here is what I am trying to do,

Since there is no actionscript function to set the registration point of a movieclip, I created a movieclip that I want to hold my image in my Project.fla file with a centered registration point.?I then add the movieclip to the stage in my Project.as file:

var holder:Holder = new Holder();
addChild(holder);

The holder is successfully on the stage, and I now load my external image file that I would like to be inside of my image placeholder:

var imageLoader:Loader;
imageLoader = new Loader();
imageLoader.load(new URLRequest(''images/ball1.png''));
addChild(imageLoader);

What I am now trying to do is insert the imageLoader into my holder so that I can alter it as though the registration point is in the center.?I think there must be a way to make the holder a parent of the imageLoader and somehow contain the image inside of it, but I am ot exactly sure what to do.?Please help.?I am using AS 3.0.

Ben

Fill a Movieclip with an Image

When you add the image child, try using:

holder.addChild(imageLoader);

I am not sure if you would then need to adjust the position of the image in the holder since you say its registration is centered.

Fill a Movieclip with an Image

Thank you

ignore. is there a delete?

No comments:

Post a Comment