Can anyone tell me why when I call the displayImage() function after I fully loaded, and try to get the _width and _height of holderClip, it comes back as zero. But if I wait 1 second after the load and run the displayImage() function through the button click, it then finds the width and height.

#include "lmc_tween.as"
var num:Number = 1;
var space:Number = 20;

function loadImage(){
   holderClip.loadMovie(num+".jpg");
   //holderClip._alpha = 0;

   this.onEnterFrame = function(){
       var lvBytesLoaded:Number = holderClip.getBytesLoaded();
       var lvBytesTotal:Number = holderClip.getBytesTotal();
       var percent = (lvBytesLoaded/lvBytesTotal)*100;
       if (lvBytesLoaded == lvBytesTotal) {
           trace("Image" + num + " loaded.");
           displayImage();
           delete this.onEnterFrame;
       }
   }
}

function displayImage():Void {
   //Image is not loaded.
   var w = holderClip._width + space;
   trace("Image width: "+holderClip._width);
   trace("Image new width: "+w);
   var h = holderClip._height + space;
   trace("Image height: "+holderClip._height);
   trace("Image new height: "+h);
   /*
   //Fade in Image / resize border
   holderClip.tween("_alpha", 100, 2, "easeOut");
   border.tween("_width", w, 1, "easeOutElastic");
   border.tween("_height", h, 1, "easeOutElastic");
   */
}
myButton.onRelease = function(){
   displayImage();
}
//Start it up!
loadImage();
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to