Parse Image in and out of XML in AS3

Scorpio.72

New Member
I have an application that I can load an image through a URLLoader and pop it into a movie clip and display that movie clip.I need to then be able to write that image into an xml file so that I can re-load the image if needed.I am currently loading the image, and then storing it as BitmapData via something along the lines of: \[code\]var decodedBitmapData:BitmapData = http://stackoverflow.com/questions/10490365/Bitmap(image).bitmapData;backgroundImageBitmapData = decodedBitmapData;\[/code\]And then I do something along the following lines to write it into an xml file. The data is stored in an object that is stored in an array called aRooms. (Which is the above "backgroundImageBitmapData".)\[code\]var tempImage:Bitmap = new Bitmap(aRooms.backgroundImageData);var bytes:ByteArray = tempImage.bitmapData.getPixels(tempImage.bitmapData.rect);var roomBG:XML = new XML( <bg> { String(bytes) } </bg>);\[/code\]That roomBG (XML) variable is then appended to the full XML file that I am exporting.From there, I need to read that xmllist and convert it to, I think, bitmapdata so I can load it via a loader. But that's where I am stuck.It is possible that I am saving it wrong as well, so if that is the case, all help and corrections are welcome.Thanks.
 
Back
Top