gpt4 book ai didi

flash - 如何使用 as3 (Flash CS5) 自动保存(无对话框)图像

转载 作者:行者123 更新时间:2023-12-01 07:44:25 25 4
gpt4 key购买 nike

这似乎是一个简单的问题,但我找不到答案。

我有这个代码:

import com.adobe.images.PNGEncoder;
var fr:FileReference = new FileReference();

var pngSource:BitmapData = new BitmapData (stage.width, stage.height);
pngSource.draw(sketch_mc);

var ba:ByteArray = PNGEncoder.encode(pngSource);
fr.save(ba,'alon20.png');

这为我节省了一个图像。我想要 自动保存 它而不是像现在这样打开一个对话框。我希望发生这种情况的原因是因为我想在渲染时拍摄每一帧的照​​片(用它制作电影)。

我错过了什么?

最佳答案

在纯闪存中,您无法在没有对话框的情况下保存文件。但是,如果它是桌面应用程序,则使用 Air :

var fs : FileStream = new FileStream();
var targetFile : File = File.desktopDirectory.resolvePath('alon20.png');
fs.open(targetFile, FileMode.WRITE);
fs.writeBytes(ba);
fs.close();

关于flash - 如何使用 as3 (Flash CS5) 自动保存(无对话框)图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5990491/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com