-
AS3 XML Flexibility For Text
I am planning to create a Flash website where I will be modifying the text content fairly frequent. I was told that I should be using XML to write my text as it would be easier to modify. I have never used XML before but before I commit myself to learning it I am wondering how flexible is it in Flash? For example, will I be able to have several external XML document (one for each of my Flash pages), and will I have full control of the colour, font, text position... and so forth?
-
FK'n_dog
pretty much YES to all of the above
make sure to lookup CDATA while you are learning.
CDATA gives you the ability to pass a set of limited html tags to the xml parser, including
asfunction (which creates text links, these links run functions in the movie)
a simple example would be ( AS2 syntax, no AS3 here )
XML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<aNode>
<![CDATA[<P ALIGN='CENTER'><B><FONT color='#FF0000'>
<a href='asfunction:myFunc,rocket.jpg'>RED ROCKET</a>
</FONT></B></P>]]>
</aNode>
FLASH
Code:
_xml = new XML();
_xml.ignoreWhite = true;
_xml.load("cdata.xml");
_xml.onLoad = function(){
showTxt.html = true;
showTxt.htmlText = this.firstChild.firstChild.nodeValue;
};
function myFunc(param){
trace(param);
};
-
Thank you a_modified_dog. I will look into that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|