Iterate through Hashtable to Display Keys (javascript)

Hi,

I’m currently trying to iterate through a hashtable using for and print each new key in a GUI Box, this is what I have so far

for(var str:String in myhash.Keys){
			GUI.Box(Rect(205, level, 500, 25), str);
			level += 30;
        }

There is a problem with this however instead of displaying each new GUI Box 30 pixels down like I’m trying to do, it instead moves all boxes down until the program quits. Why is this and most importantly how do I fix it?

You should reset level to be zero immediately before this code runs.

level = 0;
for(var str:String in myhash.Keys){
    GUI.Box(Rect(205, level, 500, 25), str);
    level += 30;
}

A more efficient way would be to build all of the rects once in start or awake. Creating a new rect every frame is not free.