Tag Archives: hash tag

Twitter, Hash Tags, Flash and URLEncoding

Recently while working on a project I had to create a way for users to Tweet a message from the application that included a hash tag in the message. To achieve this functionality, we can use a Twitter URL and pass it the message we wish to display.

We can use navigateToURL to load the url. A URLRequest automatically URL encodes the variables when it is sent, but however will not work with hash tags. Not good!

Hope is not lost however, as within Flash there is however a top level escape() function that will URLEncode a string. We can use this to help with our URLRequest because after manually typing the URL we can simply append the escaped information onto the end of it.

navigateToURL( new URLRequest("http://twitter.com/intent/tweet?text="+ escape("Hey, thanks GrindheadGames! #grindheadgames http://wp.me/p18Vcr-6y")),"_blank");

This will allow you to post messages to Twitter that includes special characters like hash tags.