Layer
class:public function toXMLNode() : Xml { var nXml = Xml.createElement("layer"); nXml.set("id", this.id); return nXml; }
Page
class:public function toXMLFile(path : String) { var xmlDoc = Xml.createDocument(); var pageNode = Xml.createElement("page"); pageNode.set("name", this.name); xmlDoc.addChild(pageNode); for(l in layers) { pageNode.addChild(l.toXMLNode()); } neko.io.File.write(path, false).writeString(xmlDoc.toString()); }
You can now save a page and all its layers by calling toXMLFile
.
3.15.12.34