2010-04-01 51 views
0

我有一個谷歌地圖在continer是UIComponent。 我要抓住這個容器製造的預覽。如何捕捉谷歌地圖頁面?

我的積分如下所示:

<mx:UIComponent id="mapContainer" 
     width="410" 
     height="300" 
    /> 


googleMap = new Map(); 
mapContainer.addChild(googleMap); 

但如果我這樣做( 「本」 - 是我UIComponent)

var bmd:BitmapData = new BitmapData(this.width, this.height, true, 0x00ffffff); 
bmd.draw(this); 

我看到以下內容:

An ActionScript error has occurred: 
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://localhost/ cannot access http://mt1.google.com/vt/[email protected]&hl=en&src=api&x=1&y=1&z=1&s=Gali. No policy files granted access. 
    at flash.display::BitmapData/draw() 

我現在可以將它添加到自定義客戶端上允許的主機上。但是我需要有任何計算機上工作制)

我試圖隱藏:

templateGoogleMapRenderer.mapContainer.setVisible(false); 
templateGoogleMapRenderer.mapContainer.includeInLayout = false; 

但它是不成功。

可能是我可以重寫我的UIComponent中的一些方法,Flex在BitmapData/draw()期間使用?

捕捉隱藏地圖對我來說是成功的結果)

回答

0

Google Map Flash API有一個名爲Map.getPrintableBitmap()的方法。如果您使用此方法,您將不會收到沙箱錯誤。示例代碼:

import flash.display.BitMap; 
import flash.display.BitMapData; 

var bitmap:Bitmap   = googleMap.getPrintableBitmap(); 
var bitmapData:BitmapData = bitmap.bitmapData; 

其中googleMap是你com.google.maps.Map對象。

相關問題