Skip to main content
Participant
December 14, 2007
Question

resizing and centering the images

  • December 14, 2007
  • 2 replies
  • 261 views
hi,
can someone tell me simple basic code for resizing and centering the images on the stage while loading from xml.

i searched in the forum but many of them are using movie clip loader. so they have used getBytesLoaded or getBytesTotal for this.

And i have developed my gallery using loadMovie.

so can someone help me regarding this??

waiting for ur help

thanks a loooooooooooot:
This topic has been closed for replies.

2 replies

Inspiring
December 15, 2007
MovieClipLoader - yes, but you don't want to use bytes as a measure of
doneness. You use the onLoadInit method of the MovieClipLoader class, which
is fired once the target is downloaded and ready to use.

So, get rid of your loadMovie and use MCLoader, and its onLoadInit.

Simple example - assumes there is a clip with an instance name of holder in
the root.

var mcl = new MovieClipLoader();
var lis = new Object();
lis.onLoadInit = function(target:MovieClip){
target._x = 100;
target._y = 100;
target._width = 320;
traget._height = 240;
}
mcl.addListener(lis);
mcl.loadClip("full url of clip or image to load", holder);


That's all ya need. But if you want to add a progress bar to show the
download, you'd add a onLoadProgress method to the lis object.
HTH


--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


December 14, 2007
everybody uses getBytesLoaded and getBytesTotal because you need to implement one preloader to make sure your images are loaded before you try to scale them

something like

if(getBytesLoaded() == getBytesTotal()) {
my_pic.xscale = 105;
my_pic.yscale = 125;
} else {
trace("not yet loaded");
}