Programming

dissectURL(url:String)

Been a while since i have shared any coding tips, but here is one for those Actionscript 3 Coders out there. Its a helper function that splits a URL up into its different parts using RegExp.

public static function dissectURL(url:String) : Object
{
var keys : Array = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
var hostExtractPattern:RegExp = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/;
var o : Object = hostExtractPattern.exec(url);
var r : Object = new Object();
for (var i:int = 0; i < keys.length; i++) { r[keys[i]] = o[i];    }
return r;
}

An example of its use would be:

var protocol : String = dissectURL(“http://www.mikecann.co.uk/?p=294″).protocol;
trace(protocol);

It would trace “http”.

Enjoy!

Icy Slicy

Well after weeks and weeks of having the game all but finished i have finally sorted out the sponsorship, ironed out the bugs (most of them) and sorted all the artwork. The game is now released and ready to be sliced up by critics on the internet.

Anyways onto the game; The object of the game is simple. Several silly critters and their things have gotten frozen in  the ice and they need your help to cut them out. Using your mouse slice off chunks of ice in this exciting physics based game!

1 25 26 27 28 29 45  Scroll to top