10 Days …

By sascha, October 26, 2008 – 1:40 pm -

… until the president election! Do the world a favor and vote for the right guys. And by that I mean not for THEM! People with at least a tad of intelligence now that Barack dances better anyway.  ;)

Customizing toString()

By sascha, September 8, 2008 – 2:15 am -

When writing classes for a framework I usually put a custom toString method into important classes so that debugging becomes easier. Normally they would go like something along the lines of:

override public function toString():String {
	return "[ClassName]";
}

… Sometimes adding properties to the returned String that give back information about the class, e.g.

override public function toString():String {
	return "[ImageClass, size=" + _size + "]";
}

But writing them rigid like that is a disadvantage when you decide later to refactor class names. Admittedly it’s also not a very elegant way so I got the idea to take the class name that is returned by getQualifiedClassName(). The only problem is that getQualifiedClassName not only provides the type name but also the whole package String of the class. Regular Expressions to the rescue! After twiddling around with them for a while (I’m by no means a RegExp expert) I got my toString method into the shape that I desired:

override public function toString():String {
	return "[" + getQualifiedClassName(this).match("[^:]*$")[0] + ", size=" + _size + "]";
}

This way it matches the String returned by getQualifiedClassName with the Regular Expression [^:]*$ which checks from the right end for an arbitrary text up to the first occurring colon, but without including the colon. Taking the first element of the Array returned by match() and you got what you need!

A nice way of using this is when writing abstract classes that contain the toString method and any subclass can use that toString method without the need to override it … that is of course unless you want ot add other output information.

Featured

Alcon

Alcon is a lightweight debugging tool for ActionScript developers that provides several straightforward and quickly accessible methods to debug any ActionScript 2 or ActionScript 3 application, be it from the Web Browser, the standalone Flash Player or an AIR Runtime. It offers an easy way to output debug information from anywhere, not just while in the Flash IDE or in the Flex Debugger. It comes packed with an Application Monitor that can monitor the framerate and memory consumption, an Object Inspector for viewing the properties of any Object, Array or Class and up to two File Loggers. Alcon runs on any platform that supports Adobe AIR and can be used with the Flex compiler, the Flash IDE or MTASC.

Continue Reading »

Tools Of The Trade Part 3: FreeMind

July 24, 2006 – 12:22 am

In my book "How to become a Flash Game Developer of World Class" I surely will not forget to mention this useful tool ... FreeMind, a Mind Mapping tool that ...

More Coding Fonts

July 21, 2006 – 2:45 pm

Found these today on my daily dose of Stumble Upon random links ... Proggy Programming Fonts! Still coding with Courier? Maybe it's time for a change?!

Photoshop Script: CenteredSelection

July 17, 2006 – 11:24 pm

Centered Selection is a simple but neat little JavaScript for Photoshop CS+ that can be used to create a rectangular or elliptical centered selection while maintaining the aspect ratio (i.e. ...

Alcon v1.0.8 - Added AS3.0 Support

July 12, 2006 – 1:12 am

I've updated Alcon (ActionScript Logging Console) to v1.0.8! The only thing that has been added in this version is a Debug Class for use with ActionScript 3.0, everything else hasn't ...

First Realtime Synthesizer in Flash

July 9, 2006 – 6:03 pm

The creator over at e-phonic.com seemingly has created the first realtime synth in Flash with AS3.0. Realtime in the meaning that it creates the produced sound completely by itself and ...

How to survive IT meetings

July 7, 2006 – 1:54 am

A Developer’s Guide to Surviving Meetings ... an invaluable guide for those long and boring meetings! Be sure to also read the comments as there are some nice tips as ...

So when do you think native graphics acceleration is due for Flash?

July 5, 2006 – 4:15 pm

ActionScript 3.0 and Flash Player 9.0 brought a big leap of speed and all kinds of changes and optimizations with it. But these mainly happen under the hood only. While ...

Oldschool Gaming Goodness in Flash

July 3, 2006 – 11:58 am

Thy Dungeonman 3: Behold Thy Graphics, a text/graphics adventure from Homestarrunner in the style of the very early days of computing. Complete with fake floppy load delay and amber screen ...

mdm Rebus - Turning AS3/Flex2 applications into .NET2 executables

July 1, 2006 – 11:05 am

mdm is working on a new tool named Rebus that can turn AS3 (and Flex2) files into .NET2 executables. It's still in beta but registered users can download and test ...

Tools Of The Trade Part 2: Hi-Logic MainType

June 30, 2006 – 3:26 pm

MainType is a relatively new font managing tool (for Win only) that puts Extensis Suitcase to shame! I've been trying Suitcase for a while but finding and activating fonts with ...

Welcome to H1DD3N.R350URC3!

These are the adventures of a random guy trying to be an independant game developer, utilizing ActionScript for programming and talking abouting gaming and nonsense in general.

Need any news feed?

 Main Feed (contains all categories), Dev Feed, Design Feed, Audio Feed, Gaming Feed, Miscellaneous Feed
Find entries: