Fixing a couple of typos :)
static public funciton cloneDictionary(oldDictionary:Dictionary,
weakKeys:Boolean = false):Dictionary
{
var newDictionary:Dictionary = new Dictionary(weakKeys);
for(var key:Object in oldDictionary)
{
new.put(key, oldDictionary[key]);
}
return newDictionary;
}
Scott
Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
http://blog.fastlanesw.com
Scott Melby wrote:
How about the following? Haven't tried it, but it seems it would work...
static public funciton cloneDictionary(oldDictionary:Dictionary,
weakKeys:Boolean = false):Dictionary
{
var new:Dictionary = new Dictionary(weakKeys);
for(var key:Object in oldDictionary)
{
new.put(key, oldDiciontary[key]);
}
return new;
}
hth
Scott
Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
http://blog.fastlanesw.com
lytvynyuk wrote:
Because
var temp:Dictionary = new Dictionary();
// put something in Dictionary
var new:Dictionary = ObjectUtil.copy(temp) as Dictionary;
doesn't work;