HTML in XML for Flash ActionScript 2
Here is the solution of inserting HTML formatted text into your Flash files through XML:
In your XML add your HTML data like this:
<htmlData><![CDATA[ Here is my <br/> html text ]]></htmlData>
As a note, you can't insert your HTML data into an XML attribute.
In your Flash file do something similar to this:
xml = new XML();
xml.ignoreWhite = true;
xml.load("myXMLfile.xml");
xml.onLoad = function () {
txt = createTextField("txt", 0, 0, 0, 0, 0);
txt.html = true;
txt.htmlText = xml.firstChild.nodeValue;
}









hey guyz, i need ur help. i am trying to gather programmers like us from all over the world to help me in my new project. i am trying to create a new social networking site. so i would need some help on flash menus, chats and so on. please any comments should be forwarded to ttfajana@yahoo.com. thank you. or you can comment here
Is it vice versa possible.. I mean HTML to XML? I am trying to design a small weather widget for my mobile. I will use the ‘LoadVars’ to load the webpage. I know there are many XML feeds available. Little curious to know about the other way. :)
Hi,
I don’t think this is possible.
The [code] [/code] is showing because you forgot 1 more childNodes to add.
Now you have one childnode:
[code]
see google here
[/code]
but with 1 childNode more, he only says:
see google here
well you get the gist, giving up on trying to post the html bit.
the post is rendering the html as html (unlike flash :p) . the xml is:
[code]
<![CDATA[see google here]]>
[/code]
and flash is rendering it out as:
[code]
see google here
[/code]
not sure how to turn the html off for the post
I have managed to get it to show up now but slightly altering a few things but I am having difficulty getting flash to render out the html. This is what I have:
var theXML:Array = new Array();
var XMLtoLoad:XML = new XML();
XMLtoLoad.ignoreWhite = true;
XMLtoLoad.onLoad = function(success) {
theXML=XMLtoLoad.childNodes[0].childNodes;
};
XMLtoLoad.load("example.xml");
function loadText(){
var theText:String = theXML[0].firstChild.nodeValue;
this.createTextField("my_txt", 10, 75, 200, 1000, 22);
my_txt.text = theText;
my_txt.autoSize = true;
my_txt.multiline = true;
my_txt.selectable = false;
my_txt.wordWrap = false;
my_txt.embedFonts = true;
my_txt.html = true;
my_txtFormat = new TextFormat();
my_txtFormat.font = "my_font";
my_txtFormat.size = 13;
my_txt.setTextFormat(my_txtFormat);
}
Here is my xml:
<![CDATA[see google here]]>
Unfortunately (unless I am missing the concept of CDATA in xml) my text is rendered in flash as:
see google here
any suggestions?
Any ideas why when i do as mentioned above, i am always coming up with a "null" for my rendered text in flash? It is finding the xml, it just has a value of "null". I am extremely confused.
Hello,
Can any one help me make this stage put on
center and middle. Link http://www.inet-us.net/1/1.html
Thank you