actionscript-3filereference

Saving a file in ActionScript 3.0 using FileReference


Hi there I have a game in actionscript 3.0

I have been browsing the internet, I have found something like this

var file:FileReference = new FileReference();
file.addEventListener(Event.SELECT, _onRefSelect);
file.addEventListener(Event.CANCEL, _onRefCancel);

var ba:ByteArray = new ByteArray();
ba.writeUTFBytes(xmlUsers);

//save into drive
file.save( ba, "myXML.xml" ); 

But I get this error:

Call to a possibly undefined method save through a reference with static type flash.net:FileReference.


Solution

  • Change your compiler settings to version 10

    default is 9