for in の挙動テスト
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
[SWF (width='450', height='450', backgroundColor='-1')]
public class FlashTest extends Sprite {
protected var textfield:TextField;
protected var o1:Object;
protected var o2:Object;
public function FlashTest() {
super();
var tf:TextFormat = new TextFormat();
tf.size = 16;
tf.font = "_typewriter";
textfield = addChildAt( new TextField(), 0 ) as TextField;
textfield.width = 450;
textfield.height = 450;
textfield.defaultTextFormat = tf;
o1 = {};
addItem("A");
addItem("B");
addItem("C");
addItem("D");
addItem("E");
addItem("F");
o2 = {
A : "A",
B : "B",
C : "C",
D : "D",
E : "E",
F : "F"
};
result();
}
protected function addItem(s:String):void {
o1[s] = s;
}
protected function result():void {
var prop:String;
for(prop in o1) {
textfield.appendText(String( "o1[" + prop + "] : " + o1[prop] + "\n" ));
o1[prop] = prop;
}
textfield.appendText("\n");
for(prop in o2) {
textfield.appendText(String( "o2[" + prop + "] : " + o2[prop] + "\n" ));
o2[prop] = prop;
}
}
}
}