Skip to content

Instantly share code, notes, and snippets.

@akisute
Created February 15, 2010 08:51
Show Gist options
  • Save akisute/304491 to your computer and use it in GitHub Desktop.
Save akisute/304491 to your computer and use it in GitHub Desktop.
var dict:Dictionary = new Dictionary();
var abesi:Sprite = new Sprite();
var hidebu:Sprite = new Sprite();
dict[abesi] = "abesi";
dict[hidebu] = "hidebu";
trace(dict[abesi]);
// "abesi"
for each (var value:String in dict) {
trace(value);
// works fine
}
for (var keyAsSprite:Sprite in dict) {
trace(keyAsSprite);
// compile error - "keyAsSprite is not String"
// fxxx Flex SDK
}
for (var keyAsObject:Object in dict) {
trace(keyAsObject);
// now it works
keyAsObject.addChild(new Sprite());
// this works too as we're expecting
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment