Re: Custom Maps in v2
Hey jjrdk, I link your copy_obj function is inadequate for the job, its 
only copying two levels.
I found this, which is used for recursively displaying properties of an 
object:, I think it could be modified to go through a maptype and copy 
all the parts.  I have also retooled it a little to display the first 
map type's properties here: http://www.onnyturf.com/parsemap.html
I have a bit of a hangover :|, so uh, I need to go nurse that for a 
little, the coding stuff makes it worse, but I'll be back soon.
the loop:
function dumpProps(obj, parent) {
   // Go through all the properties of the passed-in object
   for (var i in obj) {
      // if a parent (2nd parameter) was passed in, then use that to
      // build the message. Message includes i (the object's property name)
      // then the object's property value on a new line
      if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { 
var msg = i + "\n" + obj[i]; }
      // Display the message. If the user clicks "OK", then continue. If 
they
      // click "CANCEL" then quit this level of recursion
      if (!confirm(msg)) { return; }
      // If this property (i) is an object, then recursively process the 
object
      if (typeof obj[i] == "object") {
         if (parent) { dumpProps(obj[i], parent + "." + i); } else { 
dumpProps(obj[i], i); }
      }
   }
}
0 Comments:
Yorum Gönder
<< Home