Created
February 15, 2010 08:51
-
-
Save akisute/304491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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