# AS3/ XML conditional statement for undefined terms within an xml node

**URL:** <https://forum.kirupa.com/t/as3-xml-conditional-statement-for-undefined-terms-within-an-xml-node/291917>\
**Category:** flash\
**Created:** [July 7, 2009, 2:50pm UTC](https://forum.kirupa.com/t/as3-xml-conditional-statement-for-undefined-terms-within-an-xml-node/291917 "2009-07-07T14:50:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuzzi2ya](https://avatars.discourse-cdn.com/v4/letter/w/e79b87/32.png) [@wuzzi2ya](https://forum.kirupa.com/u/wuzzi2ya)\
**Post date:** [July 7, 2009, 2:50pm UTC](https://forum.kirupa.com/t/as3-xml-conditional-statement-for-undefined-terms-within-an-xml-node/291917/1 "2009-07-07T14:50:07Z")

</div>

How would I go about creating a conditional statement that checks to see if all the needed data in a particular node is defined or else move on to the next node in the iteration?

AS3 to move through the XML:

```auto
myTimer.addEventListener(TimerEvent.TIMER, timerHandler);
    function timerHandler(event:TimerEvent) {
        if (currentPic < xmlList.length() - 1) {
            currentPic++;
            trace("fire");
            updatePic(currentPic);
            Refresh();
        } else {
            currentPic = 0;
            updatePic(currentPic);
            Refresh();
        }
    }

```

AS3 in part for the XML paths:

```auto

function updatePic(index:int):void {
        trace(currentPic);

if (Flights.flight_mc.gate_txt.text = xmlList[index].@DepartureGate = undefined) {
            index ++;
        } else {

            Flights.flight_mc.airline_txt.text = xmlList[index].someNamespace::Airline.@Name;
            Flights.flight_mc.location_txt.text = xmlList[index].someNamespace::Destination.@City;
            Flights.flight_mc.gate_txt.text = xmlList[index].@DepartureGate;
            Flights.flight_mc.schedTime_txt.text = xmlList[index].@DepartureDate;
            Flights.flight_mc.schedTime_txt.text = newTimeStr;
            Flights.flight_mc.estTime_txt.text = xmlList[index].@EstimatedGateDepartureDate;
            Flights.flight_mc.estTime_txt.text = newTimeStr2;
            Flights.flight_mc.status_txt.text = xmlList[index].@Status;
            index ++;
        }
        trace(currentPic);
        Flights.flight_mc2.airline_txt.text = xmlList[index].someNamespace::Airline.@Name;
        Flights.flight_mc2.location_txt.text = xmlList[index].someNamespace::Destination.@City;
        Flights.flight_mc2.gate_txt.text = xmlList[index].@DepartureGate;
        Flights.flight_mc2.schedTime_txt.text = xmlList[index].@DepartureDate;
        Flights.flight_mc2.schedTime_txt.text = newTimeStr3;
        Flights.flight_mc2.estTime_txt.text = xmlList[index].@EstimatedGateDepartureDate;
        Flights.flight_mc2.estTime_txt.text = newTimeStr4;
        Flights.flight_mc2.status_txt.text = xmlList[index].@Status;
        index ++;
        trace(currentPic);
        Flights.flight_mc3.airline_txt.text = xmlList[index].someNamespace::Airline.@Name;
        Flights.flight_mc3.location_txt.text = xmlList[index].someNamespace::Destination.@City;
        Flights.flight_mc3.gate_txt.text = xmlList[index].@DepartureGate;
        Flights.flight_mc3.schedTime_txt.text = xmlList[index].@DepartureDate;
        Flights.flight_mc3.schedTime_txt.text = newTimeStr5;
        Flights.flight_mc3.estTime_txt.text = xmlList[index].@EstimatedGateDepartureDate;
        Flights.flight_mc3.estTime_txt.text = newTimeStr6;
        Flights.flight_mc3.status_txt.text = xmlList[index].@Status;
        index ++;
        trace(currentPic);

```

Would a switch case be the correct statement and if so how do I go about that in the syntax?

Thanks again for all the input and direction as it is always appreciated!
