舞台的屏幕截图 [英] Screenshot of stage

查看:193
本文介绍了舞台的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能采取的舞台并将其保存到我的Web服务器?

Is it possible to take a screenshot (dump image) of the Stage and save it to my web server?

推荐答案

这应该做的伎俩:

var myBitmapData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
myBitmapData.draw(stage);

(其实我不知道,如果你能在舞台上直接做一个平局(),你可能需要做的一切是你的图像显示的顶部代替)

(actually i'm not sure if you can do a draw() on the stage directly, you might need to do this on whatever is on top of your DisplayList instead)

然后,使用这样的事情code:<一href="http://henryjones.us/articles/using-the-as3-jpeg-en$c$cr">http://henryjones.us/articles/using-the-as3-jpeg-en$c$cr

Then use something like this code: http://henryjones.us/articles/using-the-as3-jpeg-encoder

var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(myBitmapData);

var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("jpg_encoder_download.php?name=sketch.jpg");
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
navigateToURL(jpgURLRequest, "_blank");

要发送到服务器。

这篇关于舞台的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆