To make a true clone, it's about the same in AS2 & AS3: class YourModel { public var prop:String; public var data_array:Array;
function YourModel ( p_prop:String ) { prop = p_prop; data_array = [1, 2, 3, 4]; } public function clone():YourModel { var ym:YourModel = new YourModel(); ym.prop = prop; ym.data_array = []; var i:Number = data_array.length; while(i--) { ym.data_array[i] = data_array[i]; } return ym; } } var a:YourModel = new YourModel("something"); var b:YourModel = a.clone(); ----- Original Message ----- From: "Manuel Saint-Victor" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com> Sent: Wednesday, March 15, 2006 10:21 AM Subject: [Flashcoders] Advice on how to make a copy of an object I need to make a local copy of an object- basically I have a model with some default values and would like each view to create a local model with customizations to some parameters. I've seen some ActionScript 3 ways to do this but am looking for the way it was done in AS2. Thanks, Mani _______________________________________________ Flashcoders@chattyfig.figleaf.com 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 _______________________________________________ Flashcoders@chattyfig.figleaf.com 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