Flash Builder: Why won't my mx:image show?
I have a very strange bug. I am trying to sort of take screenshots of an application and applying them to two (virtual) sides of a component. i am trying to accomplish this through creating two bitmaps (_front and _back) and setting them accordingly.开发者_如何学Python this is done in the applyImage method below. When i call this method from outside of the component, it works fine and i see my image. On the other hand, when i call applyImages from togglesides, it won't work. the image just won't show itself. When i trace the source of the _image, i can see the source is there, but it's just not showing.
Anyone know what might cause this? Could the problem be caused because i use mx:image in a spark-environment with a bitmap as source? (which I would find difficult to believe since i've never had problems with this before when just setting a url as source).
Thanks in advance.
public function applyImage(bitmap:Bitmap):void
{
if(_isFront)_front = bitmap;
else _back = bitmap;
_image.source = "";
_image.source = bitmap;
_image.maintainAspectRatio = false;
_image.mouseEnabled = false;
_image.mouseChildren = false;
_image.width = this.width;
_image.height = this.height;
}
public function toggleSides():void
{
if(_isFront){
_isFront = false;
applyImage(_back);
}
else{
_isFront = true;
applyImage(_front);
}
}
I have solved the problem by creating two images and changing their visibility, but i'm still not satisfied by this actually. I have to know what is causing this bug. So if anyone has a solution or an explanation to this bug, feel free to enlighten me :)
精彩评论