howTo: File naming using ActionScript 3.0

Hello Friends, I have got a big problem.

Aim:
When a user interacts with my Flash (AIR app, this is a chat bot application) the conversations need to be stored to resemble past memory. So each time the file should be saved with different names. How to do the naming part?)

How to create files in a folder(lets name the folder as ‘memory’) inside the application directory consecutively.
=>How to make files named past0, past1, past2, etc in ‘memory’ folder inside the application directory. If the file in already present, i.e file0 is already present then the name of the current file must be file1.

So I try to do this another way (But if you have any idea of doing it straight fashion please share the idea):
but my problem:
how to pass a variable name instead of the parameter.
i.e


var myFile:File = File.applicationDirectory.resolvePath("app:/memory/past.db");

Instead of giving directly the string “app:/memory/past.db” is there any way to give it like
app:/memory/pastX.db where X = 0, 1, 2…

*If somehow the above idea could be worked out then, I think that the variable X could be stored to another file say index and each time the user opens the app, I can read the **X **value and increment it by one and append it to “past” + **X **+ “.db” and store the modified **X *value back to index.

Please help.
I’m stuck of days.
Thank You.