开发者_如何学运维It looks like an easy question but I can't find the answer.
I have this code:
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');
which saves me an image. I want it to autosave it and not to open a dialog box as it does now. the reason I want that to happen is because I want to take picture of every frame in render time (to make a movie out of it).
What am I missing?
In pure flash, you can't save a file without a dialogbox. However, if it's a desktop app, you use Air :
var fs : FileStream = new FileStream();
var targetFile : File = File.desktopDirectory.resolvePath('alon20.png');
fs.open(targetFile, FileMode.WRITE);
fs.writeBytes(ba);
fs.close();
精彩评论