dimanche 27 novembre 2016

Can't get a list of elements from an XML object when using the elements operator?

I have been working with this XML and I'm not able to get a list of the nodes with the elements operator:

<s:LinearGradient rotation="90" xmlns:s="library://ns.adobe.com/flex/spark">
  <s:GradientEntry color="0x000000" alpha="0.8"/>
  <s:GradientEntry color="0xFFFFFF" alpha="0.8"/>
</s:LinearGradient>

Here is my AS3:

var fillXML:XML = <s:LinearGradient rotation="90" xmlns:s="library://ns.adobe.com/flex/spark">
      <s:GradientEntry color="0x000000" alpha="0.8"/>
      <s:GradientEntry color="0xFFFFFF" alpha="0.8"/>
    </s:LinearGradient>;

var entriesXML:XMLList;
var GRADIENT_ENTRY:String = "GradientEntry";
entriesXML = fillXML..entries;

if (entriesXML.length()==0) {
    entriesXML = fillXML.descendants(GRADIENT_ENTRY);

    if (entriesXML.length()==0) {
        entriesXML = fillXML.elements(GRADIENT_ENTRY);
    }
}

Aucun commentaire:

Enregistrer un commentaire