You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by wangjw <ca...@gmail.com> on 2014/05/26 09:10:52 UTC

HI,everybody,When i use BitmapData.draw ,I have a question

I have a quest,I want to save the mapcontrol(arcgis map control) to a
Image,Then send the Image to the webserver.
below the is code:
+++++++++++++++++++++++++++++++++++++++++++++
var width:Number  = map.width;
var height:Number  = map.height;
var bitmapData:BitmapData = new BitmapData(width, height);
bitmapData.draw(mapcontainer,new Matrix());	

var file:FileReference = new FileReference();
var jpg:JPEGEncoder = new JPEGEncoder();
var ba:ByteArray = jpg.encode(bitmapData);

var urlrequest: URLRequest = new URLRequest(uploadImgUrl + "?id="+appId);
urlrequest.method = URLRequestMethod.POST;
urlrequest.data = ba;
urlrequest.contentType = "application/octet-stream";
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,finishCaptureUpload);
loader.load(urlrequest);

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
When in the flash builder test mode,the code is no problem,
But when I run the swf  in  a webserver,
	bitmapData.draw(mapcontainer,new Matrix());
this line of code can't run.
I have corssdomain.xml ,but it no use.Can anybody help me ?
the reason is flex security sandbox? but i don't konw how to set.

Re: HI,everybody,When i use BitmapData.draw ,I have a question

Posted by Alex Harui <ah...@adobe.com>.
Unfortunately, you may not be able to capture graphics generated by
another domain unless that domain gives you permission.

-Alex

On 5/26/14 12:10 AM, "wangjw" <ca...@gmail.com> wrote:

>I have a quest,I want to save the mapcontrol(arcgis map control) to a
>Image,Then send the Image to the webserver.
>below the is code:
>+++++++++++++++++++++++++++++++++++++++++++++
>var width:Number  = map.width;
>var height:Number  = map.height;
>var bitmapData:BitmapData = new BitmapData(width, height);
>bitmapData.draw(mapcontainer,new Matrix());	
>
>var file:FileReference = new FileReference();
>var jpg:JPEGEncoder = new JPEGEncoder();
>var ba:ByteArray = jpg.encode(bitmapData);
>
>var urlrequest: URLRequest = new URLRequest(uploadImgUrl + "?id="+appId);
>urlrequest.method = URLRequestMethod.POST;
>urlrequest.data = ba;
>urlrequest.contentType = "application/octet-stream";
>var loader:URLLoader = new URLLoader();
>loader.addEventListener(Event.COMPLETE,finishCaptureUpload);
>loader.load(urlrequest);
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++
>When in the flash builder test mode,the code is no problem,
>But when I run the swf  in  a webserver,
>	bitmapData.draw(mapcontainer,new Matrix());
>this line of code can't run.
>I have corssdomain.xml ,but it no use.Can anybody help me ?
>the reason is flex security sandbox? but i don't konw how to set.