2011-11-18 88 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