Tuesday, June 12, 2007

Anchoring an Image to the Bottom Right Corner of a Flash File.

I need to dynamically load images into flash but the width and height could very but the image needed to stay in the lower right corner. With the help of the Help in flash this is what I came up with.


this.createEmptyMovieClip("container", 0);
var image_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace(target_mc._name+" = "+target_mc._width+" X "+target_mc._height+" pixels");
trace("stage width " + Stage.width + " stage height " + Stage.height );
image_mc._x = Stage.width - target_mc._width;
image_mc._y = Stage.height - target_mc._height;


image_mcl.loadClip("http://rcm-images.amazon.com/images/I/11I4WKohKxL._SL110_.jpg", container);


Now I know the example loads a hard coded image so it's not dynamic but this is in addition to an earlier post

No comments: