views:

118

answers:

1

I have a UIComponent with Google map in the continer. I need to capture this container for making a preview.

My integration looks like the following:

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


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

But if I do("this" - is my UIComponent)

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

I see the following:

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

I now, that I can to add it host to allowed on the custom client. But I need to have working system on any computer )

I've tried to hide it:

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

But it was unsuccessfully.

May be I can override some method in my UIComponent, that flex use during BitmapData/draw() ?

Capture with hidden map is success result for me )

+1  A: 

You may need to force the app to check google maps' cross domain policy file before attempting to access the bitmap data. Their cross domain policy file is located here: maps.google.com/crossdomain.xml

You may find this helpful if you're unsure of how to force it to check the cross domain policy file: http://www.abdulqabiz.com/blog/archives/2007/01/28/enabling-bitmapdatadraw-on-crossdomain-images-in-adobe-flash-player-9/

quoo