I’m not sure if my questions are nagging or if I’m a nagging n00b, but here goes:
I’m running flash 8 pro on a mac.
-
When I use a for … in loop to step through an array or properties of an object, it ends up being last in - first out. Here’s what I mean:
[FONT=Fixedsys]var testArray:Array = [“one”, “two”, “three”];
[/FONT][FONT=Fixedsys] // prints out three, then two, then one
[/FONT][FONT=Fixedsys] for (var i:String in testArray) {
trace(testArray*);
}
[/FONT][FONT=Fixedsys] // prints out one, then two, then three[/FONT]
[FONT=Fixedsys]for (var j:Number = 0; j<testArray.length; j++) {
trace(testArray[j]);
}
[/FONT]
What’s that all about, and is there an elegant way to make the for … in loop work first
in - first out? -
I’m trying to understand literals versus new objects. To wit:
[FONT=Fixedsys]var literalString:String = “fred”;
var objectString:String = new String(“barney”);[/FONT]
The handy manual sez “Use string literals unless you specifically need to use a String object for better performance”.
Can someone give me an example of a place to use String objects for better performance and explain a little bit about how they improve performance?
Thanks…