How about this?

class Test {
        var foo:String;
        var bar:String;
        function Test(initObj:Object) {
                for (var a:String in initObj) {
                        this[a] = initObj[a];
                }
        }
        public function get data():Object {
                var obj:Object = {};
                obj.foo = foo;
                obj.bar = bar;
                return obj;
        }
        public function copyConstructor():Test {
                return new Test(data);
        }
}



//

import Test;
test1 = new Test();
test1.foo = "Hello";
test1.bar = "World";
test2 = test1.copyConstructor();
trace(test2.foo);
trace(test2.bar);
-- Hello
-- World
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to