Hi there,
I know this is a silly question but I don’t know the answer. How can I load a text from an external XML file into the flash project? I need this text to be parsed as HTML , so in my XML i have something like this:
<!CDATA[ ........some HTML code…..... ]]>
Thanks in advance
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
Hi there,I know this is a silly question but I don’t know the answer. How can I load a text from an external XML file into the flash project? I need this text to be parsed as HTML , so in my XML i have something like this:
<!CDATA[ ........some HTML code…..... ]]>
Thanks in advance
Try this http://tinyurl.com/2u4xa6l
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Contributed a Tutorial to a Tuts+ Site
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Item was Featured
- Author was Featured
- Referred between 1 and 9 users
Paul, there’s no need for you to be sarcastic, the guy was asking for help, and I intend to point him into the right direction 
<main_node>
<cdata_node>
<![CDATA[Your <font color="#ff0000">HTML</font> code here.]]>
</cdata_node>
</main_node>
paste the code below on frame 1 of your FLA file ( AS3 only!!!)
var xmlLdr:URLLoader = new URLLoader();
var xmlUrl:URLRequest = new URLRequest("your_xml.xml");
xmlLdr.load(xmlUrl);
xmlLdr.addEventListener(Event.COMPLETE, onXMLLoaded);
function onXMLLoaded(e:Event):void
{
xmlLdr.removeEventListener(Event.COMPLETE, onXMLLoaded);//remove the XML loader event listener once the XML file is loaded
var xmlData:XML = new XML(e.target.data);//assign the data taken from the XML file to a new XML object
trace(xmlData);//traces all your XML file content
trace("================================================");//separate the previous and the next output code
trace(xmlData.cdataNode.toString());//traces precisely the HTML string that you need
}
Hope this helps!
If you really, really wanna learn, read more about XML here.
Regards,
Dani
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
No sarcasms intended Dani. His information was to vague for me to help him. I didn’t know what he needs it for, XML AS2 / XML AS3 , image loader? text loader? boolean functions, strings, numbers, arrays… So my link offered everything. Flash XML
Includes everything… understand why I did it now ?
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Contributed a Tutorial to a Tuts+ Site
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Item was Featured
- Author was Featured
- Referred between 1 and 9 users
[...] How can I load a text from an external XML file into the flash project? I need this text to be parsed as HTML [...]
I guess that pretty much explains what he needs to achieve, doesn’t it? 
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Contributed a Tutorial to a Tuts+ Site
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Item was Featured
- Author was Featured
- Referred between 1 and 9 users
I wasn’t offering him a complete, out-of-the-box, solution to his problem, I was merely pointing him into the right direction, or at least I hope so 
thank you very much guys
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Contributed a Tutorial to a Tuts+ Site
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Item was Featured
- Author was Featured
- Referred between 1 and 9 users
thank you very much guys
You’re most welcome, please let us know which solution helped you out 
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
thank you very much guys
Sorry if I sounded sarcastic. Just pointing you out in thr right direction. I learned how to use XML via googling the exact same thing i gave you in my first post:-)
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Contributed a Tutorial to a Tuts+ Site
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Item was Featured
- Author was Featured
- Referred between 1 and 9 users
thank you very much guysSorry if I sounded sarcastic. Just pointing you out in thr right direction. I learned how to use XML via googling the exact same thing i gave you in my first post:-)
@ cristy4s
Follow Paul’s (Enabled) advice, Google is your best friend when you really know what to look for 
If you wanna push your Actionscript knowledge boundaries further, start with Lee Brimelow’s video tutorials.
Here are a couple of links you might be interested in:
http://gotoandlearn.com/play.php?id=64 (ActionScript 3 XML Basics)
http://gotoandlearn.com/play.php?id=65 (ActionScript 3 Advanced XML )
There is also a tutorial over there about basic XML and Actionscript 2, although I really hope you stick with AS3 , as it’s way more powerful and nice, and coding in AS3 is far more clean and well-structured than AS2 coding 
Hope this helps! 
