# Save and Load XML File

**URL:** <https://forum.kirupa.com/t/save-and-load-xml-file/320118>\
**Category:** flash\
**Created:** [March 14, 2011, 7:24pm UTC](https://forum.kirupa.com/t/save-and-load-xml-file/320118 "2011-03-14T19:24:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piruka](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@Piruka](https://forum.kirupa.com/u/Piruka)\
**Post date:** [March 14, 2011, 7:24pm UTC](https://forum.kirupa.com/t/save-and-load-xml-file/320118/1 "2011-03-14T19:24:17Z")

</div>

Hi

It’s my first post here, and i have a doubt…

I need save a MovieClip in XML format, then i wrote this code below:

[SIZE=2]private function getDegrafaData(e:MouseEvent):void {  
var xml:XML = \_canvas.getObjectData(FormatType.DEGRAFA);  
\_saveFileRef.save(xml.toString(), “My\_Sketch.xml”);  
}[/SIZE]

ok, file saved, but when i open .xml file its empty, so i cannot load this file ;/

below is my load code:

private function generateObjects(e:MouseEvent):void {  
\_loadFileRef.browse([new FileFilter(“All Formats (_.xml)", "_.xml”)]);  
}  
private function selectFile(e:Event):void {  
\_loadFileRef.load();  
}  
private function completeFile(e:Event):void {  
\_canvas.setObjectData(newXML(\_loadFileRef[‘data’]),FormatType.DEGRAFA);  
}

anyone can help me?  
i need to do this quickly!  
sorry my english, i’m brazilian :sure:

Thanks :batman:
