Actionscript RMXml

August 13th, 2007

This flash tutorial explains how to use my Actionscript 2.0 RMXml class to load simple single node xml files into flash projects. This assumes you want to extract content data from an xml file and display it in a TextField. It even allows basic html formatting by using [brackets] in place of <html tags>

I use a class that i named RMXml in flash projects that require loading xml text content. This class is included in my “New Flash Project page” template.

I’ll probably make this a static class, or at least make a get content_txt function :D

Download the “New Flash Project” template

download “newflashproject.tar.bz2” 12.7 KB
download “newflashproject.zip” 16.5 KB
visit “New Flash Project page”

View the “RMXml” class

view “rmxml.as” 3.48 KB

How To Use RMXml actionscript 2.0

<?xml version="1.0" encoding="utf-8"?> <content> [font size="15"]My simple html content[/font] [br /] [i]examples are fun[/i] Line breaks like this will produce an extra empty line use [br /] for a single line break. [u][a href="http://remixtechnology.com"]links work too![/a][/u] so do [u]underlines[/u] and [b][u]nested tags[/u][/b] the end </content>

main.as

class main { function main(){ var myXML:RMXml = new RMXml(“myContent”, _root.myTextField); } }

if you have a dynamic text field in main.fla with an instance name of “myTextField”, a file in a subdirectory called xml/ named myContent.xml with the previously mentioned xml content, the RMXml.as and cfg.as classes in a subdirectory called classes/, and your classpath set to classes/, then the above code will certainly work. otherwise, just use my “New Flash Project page” to see how it all works together.

Say Anything