0
我使用了flex構建器3. 我有一個看起來像這樣的xml文件,請注意flag屬性。它可以是0或1:根據條件從xmllist中選擇隨機xml節點
<question id="2">
<short>OMG</short>
<meaning>Oh My God</meaning>
<hint>OMG did you hear they broke up?!</hint>
<flag>0</flag>
</question>
<question id="3">
<short>BTW</short>
<meaning>By The Way</meaning>
<hint>BTW, there's no class today</hint>
**<flag>0</flag>**
</question>
我創建包含所有的XMLList,我想在每次選擇一個隨機節點只有標誌等於0的含義我有一個條件,並根據選擇適合該條件的隨機節點。這裏是我試圖適應這一切的地方:
var countNodes:int = 25;
var i:int = int(Math.random() * 25);
var xList:XMLList = loadedXML.question[i].short;
quesLabel.text = xList.text();
test2.text=loadedXML.question[i].meaning;
關於如何選擇符合條件的隨機節點的任何想法? 謝謝!