On 12/30/05, Nathan Derksen <[EMAIL PROTECTED]> wrote:

while that is true, i thought that was what the "dynamic" keyword was
to allow, and without it, you'd get some sort of error...

That's the theory, but as the XML example shows, using the associative array syntax gets around the compile-time checking for that.

In many respects, LoadVars is doing what you want to do with your
Session class.

well, in ways, yes - in ways, no. it's doing the same on-the-fly
variable assignment, but doesn't have any other methods (like
"addItem") that would put keys/values into a specific class member.

it seems that LoadVars just iterates over the object and outputs any
property it finds (which is why "onLoad=function" used to appear in
LoadVars data).

i was doing iterations over both the class object and the Items
member. i'd obviously prefer just to have one place for all props.

Yah, that's why it is so much cleaner just to have an associative array as a private property within your class, and create addItem(), getItem(), and removeItem() methods to manage that associative array. That way you also don't have to worry about the names of added properties possibly colliding with existing property/method names within the class.

Nathan
http://www.nathanderksen.com


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to