I'm trying to make this XML file into an object in AS3.
<?xml version="1.0" encoding="utf-8"?>
<mimeTypes>
<mimeType>
<ext>.ico</ext>
<type>image/x-icon</type>
</mimeType>
<mimeType>
<ext>.txt</ext>
<type>text/plain</type>
</mimeType>
<mimeType>
<ext>.html</ext>
<type>text/html</type>
</mimeType>
</mimeTypes>
The problem is I'm trying to make the ext = the type. For example;
mimeTypes[".ico"] = "image/x-icon";
mimeTypes[".txt"] = "text/plain";
mimeTypes[".html"] = "text/html";
Is there anyway I can do this?
This is my code right now:
var mimeXML = new XML(e.target.data);
var len:uint = mimeXML.mimeType.length();
mimeT[mimeXML.mimeType.child("ext")] = mimeXML.mimeType.child("type");
for(var id:String in mimeT) {
var value:Object = mimeT[id];
trace(id + " = " + value);
}
but, it outputs:
<ext>.ico</ext>
<ext>.txt</ext>
<ext>.html</ext> = <type>image/x-icon</type>
<type>text/plain</type>
<type>text/html</type>
Any help would be appreciated, thanks!