It seems like from my testing that if you try to retrieve an XMLList from an
XML by using that notation it will always return a valid XMLList, but if the
node doesn't actually exist, the XMLList is simply empty. Check the length
of the returned XMLList:

if (xml2.lobby.length > 0) {
    trace("2: in the lobby");
}

Ktu

On Sat, Feb 6, 2010 at 12:09 PM, Alexander Farber <
alexander.far...@gmail.com> wrote:

> Hello,
>
> I've prepared a simple test case for my problem:
>
> var xml1:XML =
>        <pref>
>        <lobby>
>        <user id="DE2" name="Alex" avatar="2_1211369175.jpg"/>
>        </lobby>
>        <game id="0"/>
>        </pref>;
>
> var xml2:XML =
>        <pref>
>        <user0 id="DE2" name="Alex" avatar="2_1211369175.jpg"/>
>        </pref>;
>
> if (xml1.lobby)
>        trace('1: in the lobby');
>
> if (xml2.lobby)
>        trace('2: in the lobby');
>
> Why does this print the 2nd line too?
>
>    1: in the lobby
>    2: in the lobby
>
> I keep trying and also look in the debugger and just don't get it...
>
> Thank you
> Alex
> _______________________________________________
> 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

Reply via email to