A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Simple XML problem with children with the same name

  1. #1

    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"/>
    </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"/>
    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"

  2. #2
    Join Date
    Aug 2004
    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!?

  3. #3
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    New Hope, PA
    Have you tried
    sendAns.promotion.appendChild(<answer value="answer1"/>);
    sendAns.promotion.appendChild(<answer value="answer2"/>);
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center