Tweet parser to format urls in your text fields

A while back I created a tutorial on Active.tutsplus.com on how to create a twitter widget for your website. This tutorial has resulted in a lot of emails and great comments from people who have viewed it.....mostly good thankfully and a lot for help and advice on how to manipualte tweets etc. A few recently were about formatting the links in tweets to be clickable in a normal text field in flash. This is incredibally simple if you know how and so I have created a simple class which would parse your tweet, format the url into a 'href' tag and assign your chosen colour to the link. Then once added to a text field as htmlText would function the same as a clickable link on any web page.

The class is available here and all you need to do is include it in your source files and as the method is a public static function you do not need to instantiate it you just make reference to it like so:

Actionscript:
  1. myTwitterWidgetTextField.htmlText = TwitParser.parseTwit(pulledInTweet, 0x00FF00);

The two parameters needed are the text to be parsed and a hex value for the color of the link text...and thats it!

Happy tweeting!

This entry was posted in Actionscript 3.0 and tagged , . Bookmark the permalink.

One Response to Tweet parser to format urls in your text fields

  1. Pingback: Tweets that mention Tweet parser to format urls in your text fields | UltraVisual Blog -- Topsy.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>