SO bug in dictionary

by pleclech forked from SO dynamic access to property with custom namespace (diff: 43)
♥0 | Line 40 | Modified 2012-01-20 23:56:22 | MIT License
play

ActionScript3 source code

/**
 * Copyright pleclech ( http://wonderfl.net/user/pleclech )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2PZT
 */

// forked from pleclech's SO dynamic access to property with custom namespace
// forked from pleclech's SO object living
package {
    import flash.utils.Dictionary;
    import flash.events.Event;
    import flash.utils.setTimeout;
    import com.bit101.components.TextArea
    
    public class FlashTest extends TextArea {
        public namespace foo;
        foo var bar:String='baz';
        public function FlashTest() {
            width=400
            height=400
            setTimeout(doTest, 500)                        
        }
        public function doTest():void {
            var map:Dictionary=new Dictionary(false)
            map["a"]="value a"
            map["b"]="value b"
            map["c"]="value c"
            map["x"]="value x"
            map["y"]="value y"
            map["z"]="value z"
            trace("key without any operation")
            for (var key:String in map)
                trace("key:",key)
                
            trace("\nkey while assigning value, you will see that a key appear twice")
            for (var key:String in map) {
                trace("key:",key)
                map[key] = null
            }

            trace("\nkey while deleting value")
            for (var key:String in map) {
                trace("key:",key)
                delete map[key]
            }

        }
        public function trace(...args):void {
            text=text+args.join(", ")+"\n"
        }
    }
}

Forked