I´m loading a JPG image into an empty movie clip as an Holder.
I want to scale the JPG to the Holder´s size.
Loading is not a problem, scaling neither, but …
to get the loaded JPG _width and _heigth is burning my mind
below is the code section I´m using inside an class
var imgHolder = detail.createEmptyMovieClip ("imgHolder", detail.getNextHighestDepth ());
var my_mcl:MovieClipLoader = new MovieClipLoader ();
// Create listener object:
var mclListener:Object = new Object ();
mclListener.onLoadError = function (target_mc:MovieClip, errorCode:String, status:Number)
{
trace ("Error loading image: " + errorCode + " [" + status + "]");
};
mclListener.onLoadStart = function (target_mc:MovieClip):Void
{
trace ("onLoadStart: " + target_mc);
};
mclListener.onLoadProgress = function (target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void
{
var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
trace ("onLoadProgress: " + target_mc + " is " + numPercentLoaded + "% loaded");
};
mclListener.onLoadComplete = function (target_mc:MovieClip, status:Number):Void
{
trace ("onLoadComplete: " + target_mc._width + " " + target_mc._height);
};
my_mcl.addListener (mclListener);
my_mcl.loadClip ("cristo.jpg", imgHolder);
I thougth I could get target_mc._width and target_mc._height after the Load is complete and then apply the proper xscale and yscale to imgHolder but I get ZERO for both.
What am I doing wrong ?
Thanks any help
João Carlos
Rio
Brazil