mardi 23 juin 2015

Adding a Spark Image to a Sprite using addChild?

I am trying to workaround an issue with transparent PNGs (Preventing the bounding box of transparent Bitmap Sprite from triggering mouse events) and find that the Spark Image handles overlapping bounding boxes correctly. However my implementation doesn't display the image but also doesn't throw an error.

The code below executes in a Sprite. The "upImageData" is previously loaded BitmapData. No error is thrown and I am able to access properties of the Spark Image instance but the image doesn't display.

Does anyone know if what I am trying is possible? (I've tried all the common solutions to my "bounding box" issue but they have not worked for me).

    img = new Image()
    img.source = upImageData;
    img.smooth = true;

    trace("img", this.img.width, this.img.height);
    trace("img xy", this.img.x, this.img.y);
    trace("source", img.source);
    trace("parent", this.img.parent);

Console Output:

img 150.54 150.54
img xy 0 0
source [object BitmapData]
parent [object SatelliteImageButton]

Aucun commentaire:

Enregistrer un commentaire