Actioncript 3 filereference "save" raises an error

I have some code that saves the displayable locally as an image file, but at some point it started throwing error 2174. This code is called from either a contextual click event or a keyboard event.

var sourceBmd:BitmapData = new BitmapData(displayObject.width,displayObject.height);            
sourceBmd.draw(displayObject,new Matrix(displayObject.width,0,0,displayObject.height));
var jpgEncoder:JPGEncoder = new JPGEncoder(80);
var byteArray:ByteArray = jpgEncoder.encode(sourceBmd);
try
{
    filereference.save(byteArray,"posterImage.jpg");    
}
catch (e:Error)
{
    Debugging.alert("error: ",e.message);           
}

      

as you can see filereference only has one action - so there is no reason for error 2174. in case you are wondering - I am posting for flash player 10.0

UPDATE: I found it has to do with the flash player version: at 10.3 it works, and at 11.1 if it fails.

any ideas? cheers, eRez

+3


source to share


3 answers


Does this link help solve your problem?



Also, have you tried restarting the Flash IDE after an error occurs?

0


source


after reading the docs I can assume:

  • you work in flash player 10
  • you don't call filereference.cancel()

    in cases where the user clicks "cancel" or "close" in the dialog that opens; try it
0


source







All Articles