Chapter 10 Example 4
♥0 |
Line 17 |
Modified 2009-06-09 04:41:42 |
MIT License
archived:2017-03-09 16:30:14
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/louP
*/
package
{
import com.actionscriptbible.Example;
public class ch10ex4 extends Example {
public function ch10ex4() {
var characters:Object = {Roger: "The Author", Kumo: "The Cat"};
trace("Roger" in characters); //true
trace("Bailey" in characters); //false
//iterate through the values
for each (var value:String in characters) {
trace("I see", value);
}
//iterate through the keys
for (var key:String in characters) {
trace(key, "is", characters[key]);
}
}
}
}