The Burned Out Hippy - Hugging Flash into Submission

Converting characters into a URL friendly format

posted by The Hippy in Actionscript 3, Useful code bits

There is a handy command in Actionscript that I’d previously never encountered until this week:

escape()

If you’re receiving a text input and needing to send it out to a URL, for example in a search box, you need to convert any special characters into character codes before you request the URL. For example, a space should be sent as %20.

The escape() command allows you to do this with one command rather than having to search through character by character and reference it to a character codes array.

More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

The FindURL() Class (v1.2)

I’ve updated the FindURL class because a couple of people were asking for the ability to target a new browser window. The class can be completely overwritten and shouldn’t affect any old code that you may have produced…it targets the same window as default.

However if you want to target a new browser window you can now do so by adding an additional parameter…”_blank”. See the example below:

var input:String = "blah blah blah http://www.burnedouthippy.com blah blah blah";
var fU:FindURL = new FindURL(input, "_blank");
var output:String = fU.Process();

If you run a trace on output, you’ll see that the new string has HTML a tags inside it and it also now targets a new browser. You can change “_blank” for any other HTML target and it should work just fine…alternatively, completely leave out the second parameter and it will automatically target “_self”.

Download the FindURL v1.2

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

The CSSLoader Class (v1.0)

posted by The Hippy in Actionscript 3, Classes, Downloads

AS3 is a wonderful thing, but it can be really long-winded sometimes when you’re trying to achieve something simple – the perfect example being the replacement of AS2′s getURL() class with a series of listeners. I know why it has been set up this way, I understand why it’s better that everything follows a uniform methodology and I do wholeheartedly agree with it, but there is no getting around the fact that you can get bogged down writing the same long-winded code over and over again. Frankly, it can be a pain in the ass and can sap the fun out of simple tasks.

Sometimes I get around these chunks of code using snippets (see Lee Brimelow’s tutorial on how to set up snippets in Flex Builder), but sometimes the code is crying out for a simple class to be made – in my opinion, loading external stylesheets is one of these times.

More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Updated: FindURL (v1.1)

The FindURL class has been updated and the new version can be found here.

This new version corrects a rather embarrassing issue – the class was returning no text at all if no URL was present in the text. I was so wrapped up with trying to get it to look for URLs in a text block, it didn’t cross my mind to test it without any at all! Problem solved now though, simply overwrite the previous version and everything should work as before.

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

The FindURL class (v1.0)

posted by The Hippy in Actionscript 3, Classes, Downloads

Please note: This class has been updated. Please click here to see the latest changes.

Whilst I was playing around with the Twitter API I was beginning to get wound up by the fact that the XML feed from Twitter only sends out text versions of tweets and not HTML versions. For example, lets say a tweet says “Check out this cool link: http://www.plagro.com”, the xml feed from twitter would send out:

Check out this cool link: http://www.plagro.com"

as oppose to the html version containing the “a” link tag:

Check out this cool link: <a href="http://www.plagro.com">http://www.plagro.com</a>

So after trawling the forums looking for alternative feeds and/or HTML convertors, I came to the conclusion that it would be easier to write a small class that simply finds links within blocks of text and adds in the html tags so it can be displayed as HTML text. The result is the FindURL class.

More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg

Recent Posts
Recent Comments
About Us
mimi: You are totally freaking awesome. This did the trick....
The Hippy: I'm pretty sure that Orange are aware of it, but I'm not entirely sure as to the reas...
Headboy_Roy: After speaking to Orange for an hour and then doing the same with HTC, I used Google ...
The Hippy: You're very welcome. Glad to be of help....

This site is the playground of the The Burned Out Hippy, head honcho of the web design and multimedia company Plagro. It serves no other purpose than to act as a place where I can store my most recent Flash ActionScript experiments. However, I will be posting code whenever an experiment is complete so that you can have a play with it yourselves.

Read more about The Burned Out Hippy...