Hi Cor thanks, but that won't do.
If I write a part out in a tree structure you'll see why:
map
    map.classes
        map.classes,class1
            map.classes,class1.areaColor
            map.classes,class1.value
            ...
        map.classes,class2
            map.classes,class2.areaColor
            map.classes,class2.value
            ...
        ...
        ...
    map.layers
        ...
    ...
    ...

With the node..* syntax all properties would be assigned to the same level
But within the classes part class1 and class2 both have a property 'value'.
class2.value would overwrite class1.value.
What I basically want is to transform the xml structure into an object 
structure.
Any other takers?
Tanks
Willem van den Goorbergh

On 16 feb 2011, at 12:50, Cor wrote:

> Hi Willem,
> 
> Not sure, but what if you change this:
>    for each (var childNode:XML in node.*) {
> 
> into:
>    for each (var childNode:XML in node..*) {
> 
> Groeten,
> Cor van Dooren
> www.codobyte.com
> ------------------------------------------------------------------
> "There are only 10 types of people in the world:
>   Those who understand binary and those who don't."
> 
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Geografiek
> Sent: woensdag 16 februari 2011 12:44
> To: Flash Coders List
> Subject: [Flashcoders] checking for properties AS3
> 
> 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
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
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