1 Reply Latest reply on May 13, 2011 9:42 AM by Lee Burrows

    Dynamic Image Creation Height/Width Zero

    broconne

      I load a new image using the following method:

       

      I embed the image with:

      [Embed(source="Cube.png")]

      private var cubeImage:Class;

       

       

      Then later in the code, I initailize a new BitmapImage and set the source.

       

      var cube:BitmapImage = new BitmapImage();

      cube.source=cubeImage;

      cube.visible = false;

      cube.scaleX = .5;

      cube.scaleY = .5;

      lineGroup.addElement(cube);

      cube.visible = true;

       

      I want to modify the x and y locations of the image based in part, on the width and height of the image I am loading.  However, the width and height all return zero.  I am assuming this is because the image hasn't finished "loading" yet?? Is there a listenting I can use to be notified when the image is ready for manipulation?  I could not find one.