snail28
09-24-2008, 09:09 AM
// create an XML document
var doc:XML = new XML();
// create three XML nodes using createElement()
var element1:XMLNode = doc.createElement("level");
// place the new nodes into the XML tree
doc.appendChild(element1);
element1.appendChild(element2);
listenerKey.onKeyDown = function(){
//save data into variable
Rec.keycode = Key.getCode().toString();
Rec.beatTime = (getTimer() / 100).toString();
dataRec.push(Rec);
var keycode_node:XMLNode = doc.createElement("keyCode");
keycode_node.appendChild( doc.createTextNode( Rec.keycode ) );
var beatTime_node:XMLNode = doc.createElement("beatTime");
beatTime_node.appendChild( doc.createTextNode( Rec.beatTime ) );
//place data into xml tree
element1.appendChild(keycode_node)
element1.appendChild(beatTime_node)
trace (doc);
}
I wrote this code for insert data into xml object, and the result in the output :
for example i pressed 2 different key at different time (check out my code)
<level>
<keyCode>65</keyCode>
<beatTime>13.94</beatTime>
<keyCode>83</keyCode>
<beatTime>17.39</beatTime>
</level>
I understand that it needs Php and honestly i just can't understand what function do i have to use.and my problem is, i want to save the xml object into xml file. does anyone here has a sample code for my case ? or you can tell me how to do it ?
thanks
var doc:XML = new XML();
// create three XML nodes using createElement()
var element1:XMLNode = doc.createElement("level");
// place the new nodes into the XML tree
doc.appendChild(element1);
element1.appendChild(element2);
listenerKey.onKeyDown = function(){
//save data into variable
Rec.keycode = Key.getCode().toString();
Rec.beatTime = (getTimer() / 100).toString();
dataRec.push(Rec);
var keycode_node:XMLNode = doc.createElement("keyCode");
keycode_node.appendChild( doc.createTextNode( Rec.keycode ) );
var beatTime_node:XMLNode = doc.createElement("beatTime");
beatTime_node.appendChild( doc.createTextNode( Rec.beatTime ) );
//place data into xml tree
element1.appendChild(keycode_node)
element1.appendChild(beatTime_node)
trace (doc);
}
I wrote this code for insert data into xml object, and the result in the output :
for example i pressed 2 different key at different time (check out my code)
<level>
<keyCode>65</keyCode>
<beatTime>13.94</beatTime>
<keyCode>83</keyCode>
<beatTime>17.39</beatTime>
</level>
I understand that it needs Php and honestly i just can't understand what function do i have to use.and my problem is, i want to save the xml object into xml file. does anyone here has a sample code for my case ? or you can tell me how to do it ?
thanks