simo
simo

Reputation: 24568

Why dose mx.controls.Image appear as broken?

In my KPage class that extends Sprite, I am trying to generate a thumbnail out of it Here is my implementation inside KPage:

_thumbnail= new mx.controls.Image();    
_thumbnail.width = 100;
_thumbnail.height = 100;
_bitmd= new BitmapData(100, 100);

var mtrx:Matrix= new Matrix();
mtrx.scale(_bitmd.width/ width, _bitmd.height/ height);
_bitmd.draw(this, mtrx); // this is the KPage sprite, which has some shape childs ..
_thumbnail.source= _bitmd;

When I add _thumbnail to an s:VGroup via addElement where s is xmlns:s="library://ns.adobe.com/flex/spark" I simply get an image that looks as broken linked, like this:

enter image description here

I tried not to use the matrix, but, I've got the same result .. any idea?

Upvotes: 0

Views: 61

Answers (1)

Anas
Anas

Reputation: 731

you need to set source as Bitmap not BitmapData:

_thumbnail.source= new Bitmap(_bitmd);

Upvotes: 2

Related Questions