在AS3中我可以寫下面的(?):如何OpenFL(HAXE)通過XML導出(保存)數據
fileReference = new FileReference();
var xmlStage:XML = new XML(<STAGE/>);
var xmlObjects:XML = new XML(<OBJECTS/>);
var j:uint;
var scene:SomeScene = ((origin_ as SecurityButton).origin as SomeScene);
var object:SomeObject;
for (j = 0; j < scene.objectArray.length; ++j) {
object = scene.objectArray[j];
if (1 == object.saveToXML){
var item:String = "obj";
var o:XML = new XML(<{item}/>);
[email protected] = scene.objectArray[j].x;
[email protected] = scene.objectArray[j].y;
[email protected] = scene.objectArray[j].name;
[email protected] = scene.objectArray[j].band;
[email protected] = scene.objectArray[j].frame;
[email protected] = scene.objectArray[j].width;
[email protected] = scene.objectArray[j].height;
[email protected] = scene.objectArray[j].sprite;
[email protected] = scene.objectArray[j].bodyType;
xmlObjects.appendChild(o);
//System.disposeXML(o);
}
}
xmlStage.appendChild(xmlObjects);
fileReference.save(xmlStage, "XML.xml");
//System.disposeXML(xmlObjects);
//System.disposeXML(xmlStage);
//fileReference = null;
有同等方式HAXE做到這一點? (感興趣的目標:HTML5)
如果不是,我的選擇是什麼?
(此代碼AS3的輸出結果顯示在下面這個鏈接)
https://pastebin.com/raw/5twiJ01B
你的Haxe目標是什麼? – Confidant
HTML5是我使用Haxe時的主要目標 –