Q:

Multiple variables in Filestream (AS3)

I'm using Filestream to save the score on my android game. Recently, I've decided to add extra levels. For these levels, I need to keep track of multiple type of scores. Here is my code for one variable:
function writePion(): void { //First function to create/write in the file
    var pion: Object = new Object();
    pion.value = numeroPion; //value of object = variable value
    trace("Pion (writeObject value)= " + pion.value);

    var file2: File = File.applicationStorageDirectory.resolvePath("pion.menes");
    var fileStream2: FileStream = new FileStream();
    fileStream2.open(file2, FileMode.WRITE);
    fileStream2.writeObject(pion);
    fileStream2.close();
};

function readPion(): void { //second function to read the file and modify the variable.

    var file2: File = File.applicationStorageDirectory.resolvePath("pion.menes");
    if (!file2.exists) {
    return;
}
    var fileStream2: FileStream = new FileStream();
    fileStream2.open(file2, FileMode.READ);
    var pion: Object = fileStream2.readObject();
    numeroPion = pion.value; //update the variable
    trace("pion (readObject value)= " + numeroPion)
    fileStream2.close();
};

What I want to know if do i have to make one of those functions per type of score or is there a way to adapt it to save (about 10) new variables? 
Thanks :)
Jeryl.

A:

if filestream.writeObject() can write any object, you can define and assign any number of fields in it using this syntax:
var pion:Object = { value: numeroPion, value2: numeroPion2, some_other_value: numeroPionSomeOther }; // and so on

And you can read these values
numeroPion = pion.value;
numeroPion2 = pion.value2;
// ... and so on

