Targeting a XML element from AS2

Hello again forum, I’m still working in flash/XML project and every time I have a question about it, now it went very deep and the answer of this question is my only alternative.

ok. so I have my XML document which I load in flash, now in flash I want to scope a spescific tag of my xml document with a variable.


<?xml version="1.0" encoding="utf-8"?>
<company>
    <marketing>
        <employeeOffice>
            <employee name="employee1" salary = "1000"/>
            <employee name="employee2" salary = "1100"/>
            <employee name="employee3" salary = "1200"/>
            <employee name="employee4" salary = "1300"/>
            <employee name="employee5" salary = "1400"/>
        </employeeOffice>
        <employeeRoad>
            <employee name="employee1" salary = "1000"/>
            <employee name="employee2" salary = "1100"/>
            <employee name="employee3" salary = "1200"/>
            <employee name="employee4" salary = "1300"/>
            <employee name="employee5" salary = "1400"/>
        </employeeRoad>
    </marketing>
    <production>
        <employeeOffice>
            <employee name="employee1" salary = "1000"/>
            <employee name="employee2" salary = "1100"/>
            <employee name="employee3" salary = "1200"/>
            <employee name="employee4" salary = "1300"/>
            <employee name="employee5" salary = "1400"/>
        </employeeOffice>
        <employeeRoad>
            <employee name="employee1" salary = "1000"/>
            <employee name="employee2" salary = "1100"/>
            <employee name="employee3" salary = "1200"/>
            <employee name="employee4" salary = "1300"/>
            <employee name="employee5" salary = "1400"/>
        </employeeRoad>
    </production>
    <sales>
        <employeeOffice>
            <employee name="employee1" salary = "1000"/>
            <employee name="employee2" salary = "1100"/>
            <employee name="employee3" salary = "1200"/>
            <employee name="employee4" salary = "1300"/>
            <employee name="employee5" salary = "1400"/>
        </employeeOffice>
        <employeeRoad>
            <employee name="employee1" salary = "1000"/>
            <employee name="employee2" salary = "1100"/>
            <employee name="employee3" salary = "1200"/>
            <employee name="employee4" salary = "1300"/>
            <employee name="employee5" salary = "1400"/>
        </employeeRoad>
    </sales>    
</company>

Let’s say that my var is

var whichDepartment = marketing;

and from there I can target departement and then look for the information that is within this XML element.

I know that this is not possible in AS2 and I want to know if there is some way to get something similar…

var whichDepartment_01= myXML.firstChild.whichDepartmen.childNodes.nodesName;

Any help will be appreciated :slight_smile: