I would like to use FileReference.save() in 4 different place in a flash game. All 4 methods are the same (copy & paste). Locally, all 4 work perfectly however when I put the swf in browser, facebook actually, only one of them works as expected and the others do not. In Chrome, all 3 have never worked. In Safari, they work sometimes but nondeterministic. What can be the reason? Any idea?
By the way, I compiled with Air 2.5 and Air 3.2 Desktop, I use Flash CS6
private function onScreenShotButtonClicked(e:MouseEvent)
{
mScreenShotButton.removeEventListener(MouseEvent.CLICK, onScreenShotButtonClicked);
var finalBitmapData:BitmapData = new BitmapData(810, 520, true, 0x00000000);
var finalBitmap:Bitmap = new Bitmap(finalBitmapData, PixelSnapping.ALWAYS, false);
finalBitmapData.draw(mParent.root);
var finalData:ByteArray = new ByteArray();
finalData = PNGSave.encode(finalBitmapData);
var tempFileReference:FileReference = new FileReference();
tempFileReference.addEventListener(Event.COMPLETE, onSaveCompleted);
tempFileReference.addEventListener(Event.CANCEL, onSaveCancelled);
tempFileReference.save(finalData, "boombox.png");
}