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

Using Kore 2 more efficiently with User Tags

Kore 2 from Native Instruments is probably every sound organizer’s wet dream with sugar on top. Not only  can it control a multitude of Softsynths but it’s database makes it easy to organize sounds and find them quickly when needed. I’ve purchased this nice tool last December and what’s better than telling a few details on how I put it’s features to good use?!

Continue Reading »

Fixing other people’s code

September 22, 2006 – 1:44 pm

I just had to refuse the second job offer this year where I would have to fix somebody else's written ActionScript 1 spagetti code! I don't know what is the ...

Flash Filter Lab - The Flash 8 Filter Construction Set

August 31, 2006 – 8:34 pm

[ad#ad_content_small]flashfilterlab.com ... quite awesome! In case you've missed it, you can create your own Flash 8 Filters in a Construction Set-like environment where you connect virtual cables to generator boxes ...

AS3 Short Variable/Function Names vs Long Ones

August 30, 2006 – 2:07 am

In ActionScript it was common knowledge that shorter Variable and Function names yielded better performance in situations were it depends but does that still hold true for ActionScript 3.0? I've ...

Which Open Source License is good for you?

August 24, 2006 – 7:26 pm

I was trying out Google's own code repository Google Code today, finally delving into some SVN knowledge with Subclipse and was starting to wonder if there is actually an explaination ...

Isometric Game Development with Flash

August 20, 2006 – 11:52 am

I'm currently developing a role-playing game in AS3.0 (non-fantasy themed!!) in my spare time. This has been and still is in the design phase since a while and I'm pondering ...

The Challenges of new Keyboards

August 17, 2006 – 11:49 pm

[ad#ad_content]I must have been temporally mind absent when I strolled through Akihabara some days ago and went into a Computer Shop to buy this cute little - but ridiculously overpriced ...

Time for a new Rig!

August 8, 2006 – 3:30 pm

Being that old hardware DIY'er that I am (it started long ago with changing the kernel of my C64) I've so far always bought parts and built my PCs up ...

Roland TB-303 Emu in Flash!

July 27, 2006 – 4:05 pm

... Ok, a bit of exaggeration here but it comes pretty close! In case you missed it, Andre Michelle has written a RealTime Synth with ActionScript 3.0 that immitates an ...

SWG … once again

July 26, 2006 – 1:01 pm

[ad#ad_content]So after about six months of absence I've decided to subscribe for a month back into SWG to see if things changed for the better (and to see if my ...

The Crappiest Corporate Site of the Week

July 24, 2006 – 9:06 pm

The "Crappiest Corporate Site of the Week" Award goes to Dell Japan for not being able to have a Shop website that runs on current Browsers! When I try to ...

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: