A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: toXMLString problem

  1. #1
    Senior Member catapop's Avatar
    Join Date
    Nov 2005
    Posts
    114

    toXMLString problem

    hi. I have the following code:
    Actionscript Code:
    var xml:XML=new XML("<info></info>");
                xml.appendChild("<action>login</action>");
                xml.appendChild("<username>"+this.user+"</username>");  
                xml.appendChild("<password>"+this.pass+"</password>");  
                            trace(xml.toXMLString()+"\n");

    the following code works great if I compile the flash as flash 9, but if I compile it as flash 10 i receive the following message
    <info>
    &lt;action&gt;login&lt;/action&gt;
    &lt;username&gt;username&lt;/username&gt;
    &lt;password&gt;pasword&lt;/password&gt;
    </info>
    how can I make it send without the converting it to html entity code ??
    Like I said works great in flash 9, but I need to work in flash 10 as well.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    The way you wrote it does not apply in Flash 10. This is correct:

    var xml:XML = new XML(<info></info>);
    xml.appendChild (<action>login</action>);
    xml.appendChild (<username>this.user</username>);
    xml.appendChild (<password>this.pass</password>);
    trace (xml.toXMLString()+"\n");


    or you write your way and for what you want to do you do this trace:
    trace (xml.toString()+"\n");
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member catapop's Avatar
    Join Date
    Nov 2005
    Posts
    114
    Thanks for your help. so basically what can I do if I want to convert this code

    Actionscript Code:
    var xml:XML = new XML("<info></info>");
    xml.appendChild ("<action>login</action>");
    xml.appendChild ("<username>"+this.user+"</username>");
    xml.appendChild ("<password>"+this.pass+"</password>");
    xml.appendChild ("<"+this.type+">"+this.typeValue+"</"+this.type+">");
    trace (xml.toXMLString()+"\n");

    into a flash 10 valid one?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You use xml.toString() and then the variables are recognized as such.
    - The right of the People to create Flash movies shall not be infringed. -

Tags for this Thread

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