2011-11-18 92 views
1

我有一个奇怪的问题,Chrome浏览器中的Flash Player没有更新,除非浏览器调整大小。该应用程序是一个用Flex编写的在线设计工具,其中一项功能允许用户上传图像并剪切。图像加载正常,并且裁剪操作不会重新加载图像,但使用Bitmap.copyPixels创建裁剪版本。Flash和Chrome呈现错误

当我在本地主机上测试(虽然本地服务器不只是直接从文件系统),问题不会发生。然而,在我们的QA服务器上,除非您调整浏览器大小,否则当我认为屏幕刷新被强制时,图像不会显示。

我试图在AS3所有常见的犯罪嫌疑人/ Flex的强制重绘,updateAfterEvent的,invalidateDisplayList等

我们想出了一个哈克的解决办法是调整由像素的浏览器,但是这是显然不是理想的,我更喜欢解决方案的解决办法:)

谢谢!

下面是引用位图码...

var cropData:BitmapData = new BitmapData(_crop.width, _crop.height); 
var originalData:BitmapData = new BitmapData(_loader.width, _loader.height); 
originalData.draw(_loader); 
cropData.copyPixels(originalData, _crop, new Point()); 

var crop:Bitmap = new Bitmap(cropData); 
crop.smoothing = true; 
this.addChild(crop); 

if (_width > 0 && _height > 0) 
{ 
    crop.width = _width; 
    crop.height = _height; 
} 
+1

我不知道你的问题是什么。你期望看到什么样的更新?该更新如何被触发?由于它在一个环境中工作,但不在另一个环境中工作,所以我的第一个冲动是这不是一个bug;但是导致问题的两种环境之间有些不同。 – JeffryHouser

+0

加载程序和容器代码会很有帮助。 –

回答

1

的flash播放器嵌入用的wmode参数组为“不透明”,与此设置似乎有Chrome的Flash播放器偶尔会出现一个错误,其中关闭Flex mx:Panel组件不会导致屏幕更新。

删除wmode参数可修复上述问题,但该错误依然存在。

2

我第一个冲动是你的两个环境的编译器different.I一旦发现由Flash Builder和mxmlc的Linux下箱编译结果不一样。

2

尝试将“enterFrame”事件添加到“this”并移动裁剪位图以查看会发生什么。从它的外观来看,这是闪光灯/铬合金的缺陷。它在其他浏览器上工作吗?

编辑:

尝试增加这一点,看看会发生什么:

var crop:Bitmap = new Bitmap(cropData); 
crop.smoothing = true; 
this["cropTest"] = crop; // Add this 
this.addEventListener(Event.ENTER_FRAME, onEnterFrameTest); // Add this 
this.addChild(crop); 

// Add this function 
protected function onEnterFrameTest(evt : Event) : void { 
    this["cropTest"].x += this["cropTest"].x > 0 ? -1 : 1; 
} 

如果它给出了一个错误,就关掉这个[ “cropTest”]与此声明的变量。

EDIT2:

用以下内容替换所有的代码所示:

this["loaderTest"] = _loader; 
this.addEventListener(Event.ENTER_FRAME, onEnterFrameTest); // Add this 

// Add this function 
protected function onEnterFrameTest(evt : Event) : void { 
    this.removeEventListener(onEnterFrameTest); 

    var _loader = this["loaderTest"]; 
    var cropData:BitmapData = new BitmapData(_crop.width, _crop.height); 
    var originalData:BitmapData = new BitmapData(_loader.width, _loader.height); 
    originalData.draw(_loader); 
    cropData.copyPixels(originalData, _crop, new Point()); 

    var crop:Bitmap = new Bitmap(cropData); 
    crop.smoothing = true; 
    this.addChild(crop); 

    if (_width > 0 && _height > 0) 
    { 
     crop.width = _width; 
     crop.height = _height; 
    } 
} 
+0

感谢您的例子,不幸的是渲染错误仍然发生。没有图像出现,直到我调整浏览器的大小,然后我看到它在x位置跳舞:) – kreek

+0

如果您使用originalData作为位图的内容,'var crop:Bitmap = new Bitmap(originalData);'怎么了? – felipemaia

+0

同样的结果,直到Chrome调整大小后才会显示图片。我将尝试一个直接的AS3项目,而不是Flex来查看是否可以重现它。 – kreek