Hi list,
I posted this question a week ago on flash tiger, but never got an answer. So I 
try my luck here.

I create an object and dynamically assign properties to it, values from 
xml-nodes.
If an xml-node has child nodes the property assigned is an object and the 
values of the child nodes are assigned as properties to that object:

private function createProperties(node:XML, container:*):void {
    for each (var childNode:XML in node.*) {
        if(childNode.children().length() == 0) {
            container[childNode.localName()] = null;
        } else if(childNode.children().length() == 1) {
            container[childNode.localName()] = childNode.*;
        } else {
            container[childNode.localName()] = new Object();
            createProperties(childNode, container[childNode.localName()]);
        }
    }
}

Now I want to trace what properties are created with the following function:
private function traceProperties(object:Object):void {
    for (var prop:* in object) {
        trace(prop + " is: " + object[prop]);
        traceProperties(prop);
    }
    if(object.hasOwnProperty("layers")) {
        trace("this.layers.gemeenteNaam.title is: " + 
this.layers.gemeenteNaam.title);
        trace("this.classes.class1.keyText is: " + this.classes.class1.keyText);
    }
}

This traces:
source is: null
note is: null
subTitle is: null
copyright is: Geografiek, 2011
mapType is: chorochromaat
classes is: [object Object]
key is: [object Object]
layers is: [object Object]
this.layers.gemeenteNaam.title is: gemeentenamen
this.classes.class1.keyText is: Noord-Nederland

>From this I gather that all properties are actually created on their desired 
>level (last 2 traced lines).
But the function traceProperties() does not automatically catch all properties. 
At least not the properies inside the objects
How do I check if an object has properties at all and how do I trace them?
TIA
Willem van den Goorbergh

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or cell 
phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: www.geografiek.nl
twitter: @wvdgoorbergh
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=





_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to