If nodeName is a class, you'll need to create a clone method in that class as well, and do this:
obj.nodeName = nodeName.clone(); If it's just a string, you can try: obj.nodeName = nodeName.toString(); -TH --- In flexcoders@yahoogroups.com, geckko <geckko80@...> wrote: > > Hi all, > > I'm trying to duplicate one object but when i modify the "master" object > the child object is modified too. My code is something similar to this > > private function cloneLeaf():CallMonitoringLeaf{ > var obj:CallMonitoringLeaf = new CallMonitoringLeaf(); > obj.optionCallMonitoring = optionCallMonitoring; > obj.nodesSelected = nodesSelected; > obj.dataCallMonitoring = dataCallMonitoring; > obj.nodeName = nodeName; > return obj; > } > > But when i modify nodeName (for example) in the object that i use to > duplicate (master object), the child object modifies its name too. Is > there any way to avoid this behaviour? > > Thanks in advance >