|
|||
|
1. in the actionscript make a xml object and convert it to a string
2. in swfkit, get the value of the xml string Code:
var xml = FlashPlayer.getVariable("_root.myXML");
Code:
var name = Dialogs.fileSave("XML file(*.xml)|*.xml|");
if (name)
{
var file = new FileStream(name, "w");
file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
file.writeLine(xml);
file.close();
}
Code:
//convert a string to an utf8 encoded string stream
function toUTF8(string)
{
var i;
var stream = new StringStream;
for (i = 0; i < string.length; i++)
{
var code = string.charCodeAt(i);
if (code < (1 << 7))
{
stream.put(code);
}
else if (code < (1 << 11))
{
stream.put((code >> 6) | 0xC0);
stream.put((code & 0x3F) | 0x80);
}
else if (code < (1 << 16))
{
stream.put(0xE0 | ((code >> 12) & 0x0F));
stream.put(0x80 | ((code >> 6) & 0x3F));
stream.put(0x80 | (code & 0x3F));
}
else if (code < (1 << 21))
{
stream.put((code >> 18) | 0xe0);
stream.put(((code >> 12) & 0x3f) | 0x80);
stream.put(((code >> 6) & 0x3f) | 0x80);
stream.put((code & 0x3f) | 0x80);
}
}
return stream;
}
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|