-
Simple XML problem with children with the same name
I want flash to trace this:
<myxml version="1.0">
<promotion promotion-id="666">
<answer value="answer1"/>
<answer value="answer2"/>
</promotion>
</myxml >
so i do this in flash ac3
var sendAns:XML = <myxml />;
sendAns.@version = "1.0";
sendAns.promotion.@["promotion-id"] = _nPromoID;
sendAns.promotion.answer.@value = "answer1"
sendAns.promotion.answer.@value = "answer2";
trace (sendAns);
The trace only shows 1 answer
<myxml version="1.0">
<promotion promotion-id="666">
<answer value="answer1"/>
</promotion>
</myxml
I understand the problem of it over-riding answer but something like this doesnt work:
sendAns.promotion.answer[0].@value = "answer1"
sendAns.promotion.answer[1].@value = "answer2"
-
there is a semi colon missing on line 4 of the example - is this in your code? i dont know as3, but it might not be tolerent of that!?
-
OOP is one letter from OOPS
Have you tried
sendAns.promotion.appendChild(<answer value="answer1"/>);
sendAns.promotion.appendChild(<answer value="answer2"/>);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|