Welcome to WebmasterWorld Guest from

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Loading XML in FLash with URL's



10:13 am on May 11, 2009 (gmt 0)

5+ Year Member

Hello all.

I am a step away from finishing the website, but that last step I just cannot figure out.
I have Flash file to which XML file is loaded. This displays text and it works perfectly.
Problem is that in some of the words form XML i would like to inser links to URL's which should be open in a new window. I can't figure this out.
Could you please heltp me. Bellow you can see both AS and XML.


<loadtext><headLine>FLASHSCROLLBARMAID</headLine><br><mainBody>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy

Action Script:

_root.scrollbar_mc.scroller_mc.onPress = function()
startDrag(_root.scrollbar_mc.scroller_mc,false,0,0,0,_root.scrollbar_mc._height-_root.scrollbar_mc.scrol ler_mc._height);
_root.scrollbar_mc.onEnterFrame = function()
con = Math.ceil(100 * ((_root.scrollbar_mc.scroller_mc._y)/(_root.scrollbar_mc._height-_root.scrollbar_mc.scroller_mc._height)));
_root.tTe xt.scroll = (con/100) * _root.tText.maxscroll;
_root.scrollbar_mc.scroller_mc.onRelease = function()
_root.scrollbar_mc.scroller_mc.onReleaseOutside = function()

tText.html = true;
tText.wordWrap = true;
tText.multiline = true;
tText._alpha = 100;
tText.border = false;
tText.backgroundColor = 0xDCDBD9;
// makes it scrollable

loadtextStyleCast = new TextField.StyleSheet();
// create a new instance of a Class StyleSheet

// loads your CSS document with defined tags

tText.styleSheet = loadtextStyleCast;
// applies your new XML styles to myText

// sets the background color
// (Text color is set in the CSS.)

loadtextContentCast = new XML();
// create a new instance of an XML Class

loadtextContentCast.ignoreWhite = true;
// identifies the file to be loaded

loadtextContentCast.onLoad = function(success)
tText.text = loadtextContentCast;
// loads the file into the TextArea


Thnax in advance


4:11 am on May 12, 2009 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Hi tomtukin, Welcome to WebmasterWorld!
I haven't used Flash in a while, but I recall that if you put HTML into a text area, it'll render the HTML with working clickable links. I may be wrong ;)

anyways, I'd suggest you format your XML with the HTML wrapped as a CDATA node, so it's treated as a string, not a nodeset. For example:

<![CDATA[Lorem <a href='ipsum.html'>ipsum</a> dolor sit amet]]>

See if that works... cheers


Featured Threads

Hot Threads This Week

Hot Threads This Month