There are many ways that you can use to check the child existence for XML in AS3. Consider we have a data XML that we need to determine whether “video” node is existed or not:
?View Code ACTIONSCRIPT1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var myData:XML =
<data>
<item id="0">
<video>example.flv</video>
</item>
<item id="1">
<image>example.jpg</image>
</item>
</data>;
trace("Item with id = 0");
trace(myData.item.(@id == 0).video != undefined);
trace(myData.item.(@id == 0).child("video") != undefined);
trace(myData.item.(@id == 0).child("video").length());
trace("video" [...]
continue reading.....