I have this situation where i’m trying to save “chat logs” while people switch around views in my flex mobile application..
so, my plan is i’m starting out with a main object that I plan to re-use as the main chat log object..I call it textObj
so, when someone new wants to chat my plan is to make a new object with the persons username
so how if i were to get the username from something like data.username how could I translate that into the var name of the object I want to make? So in the end i end up with
var uniqueUsername:Object = new Object();
so I can eventually do something like
uniqueUsername.chatLog="Sample text log";
EDIT: I guess I wasn’t clear I dont literally mean uniqueUsername as the username….
say data.username was equal to AwesomeDudeYeah
and I wanted to make
var AwesomeDudeYeah:Object = new Object();
I cant just do
var data.username:Object = new Object();
so how could I make that work?
I want to make the username how I refer to the chat logs inside the textObj
Then how would I go about adding that to the textObj obj?
So i end up with textObj.uniqueUsername.chatLog="Sample text log";
which i could reference by doing textObj[uniqueUsername][chatLog]
(at least I think thats how it would be done)
Any help on these topics would be great!
bracket notation
if uniqueUsername does not exist in the textObj then you will get errors so make sure you handle them
The error gods will smite you down
[EDIT]
After reading your comments with Jax I think you should rework it a bit and make it more readable
Personally I would make a user class and hold user data in that.