assuming var itemSource:XML is assigned to the structure below... I think "if(itemSource.Media != undefined)" should do it.

hth
Scott

kc7cia wrote:

Hi,

I was hoping someone could tell me how to check to see if an XML
element exists in AS3. I have an XML structure that looks like this:

<ItemSource component="DAM">
<Value>Candy</Value>
<Media caption="Glucose Meter">10-372.gif</Media>
</ItemSource>

I want to be able to check to see if the ItemSource element has a
Media subelement. The following code does not appear to work:

if (node.ItemSource.Media.text() != null)
Alert.show('media');
else
Alert.show('no Media');

It always returns true, regardless of whether or not there is a Media
subelement. Any help would be appreciated. Thanks!


Reply via email to