Question

The basic setup is this: I am loading text from external text file into a "news & events" style dynamic text field, which is nested within a movieclip.

Like so:

var newsloader:URLLoader = new URLLoader(new URLRequest("vzm_news_text.txt"));
newsloader.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void{
    var loadedText:URLLoader = URLLoader(event.target);
    homeContent.newsText.condenseWhite = true;
    homeContent.newsText.htmlText = loadedText.data;
    homeContent.scrollBar.update();
}

My external .txt file contains simple html formatting tags and loads/displays perfectly.

What I can't figure out is: How do I make active links within the text that gets loaded?

I tried adding A HREF tag in the .txt file, but the link and everything after it doesn't display. I'm sure this is simple, and I've searched quite a bit with no luck. I am a novice learning as I go.

Was it helpful?

Solution

Check that your href line doesn't include any &, " or ' that might be breaking the text variable.

Alternatively, if you can load .xml instead of .txt you can enclose your news on CDATA tags.

<newstext>
<![CDATA[<a target="_blank" href="http://www.google.com/"> www.google.com</a>]]>
</newstext>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top