Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving and Deleting in AS3 with XML
    primarykey
    data
    text
    <p>I am trying to save something in XML via an AS3 application. I think I have the right save function so I think it lies in my function that pushes data to XML. I also am not sure on the syntax for deleting a node in XML. </p> <p>Here is my save function:</p> <pre><code>public function saveData():void { var file:File = File.desktopDirectory.resolvePath("newPlayer.xml"); var stream:FileStream = new FileStream() stream.open(file, FileMode.WRITE); var newXML:XML = new XML("&lt;player&gt;&lt;/player&gt;"); newXML.appendChild(playerList.source); var str:String = newXML.toString(); stream.writeUTFBytes(str); stream.close(); } </code></pre> <p>My function that pushes the data to XMl via a text input box:</p> <pre><code>//add a new player from text input into newPlayer.xml var newPlayer:XML = &lt;player&gt;&lt;/player&gt;; newPlayer.@name = myTextBox.text; playerData.appendChild(newPlayer.@name); myPlayerLabel.text = newPlayer.@name; </code></pre> <p>This is in my init function that loads on app complete as well. I think this is what loads the XML back in when I restart the program:</p> <pre><code>public function init():void { var file:File = File.desktopDirectory.resolvePath("newPlayer.xml"); var stream:FileStream = new FileStream(); stream.open(file, FileMode.READ); var str:String = stream.readUTFBytes(stream.bytesAvailable); stream.close(); playerData = XML(str); } </code></pre> <p>I think the problem lies within the input, but I am not completely sure since XML is new to me. Thanks in advance for any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload