【发布时间】:2011-05-30 14:45:18
【问题描述】:
我有一个非常奇怪的错误。我正在尝试截取应用程序的屏幕截图并将它们应用到组件的两个(虚拟)侧。我试图通过创建两个位图(_front 和 _back)并相应地设置它们来实现这一点。这是在下面的 applyImage 方法中完成的。当我从组件外部调用此方法时,它工作正常并且我看到了我的图像。另一方面,当我从切换边调用 applyImages 时,它不起作用。图像不会显示出来。当我追踪 _image 的来源时,我可以看到来源在那里,但它只是没有显示。
有人知道这可能是什么原因吗?可能是因为我在以位图为源的火花环境中使用 mx:image 引起的吗? (我很难相信,因为在将 url 设置为源之前,我从来没有遇到过这个问题)。
提前致谢。
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);
}
}
【问题讨论】:
标签: actionscript-3 image bitmap flash-builder bitmapdata