Animated Bitmap Class

Sunday, September 23rd, 2007

The AnimatedBitmap class provides functionality for Bitmap objects that are animated by using a series of still images. When creating a new AnimatedBitmap you provide a BitmapData object that contains an image that consists of the ’single-frame’ images for the animation.

(more…)

Understanding Interfaces and Polymorphism

Saturday, November 18th, 2006

I’ve been using Interfaces a couples of time now when needed but I never fully understood those down-sized Class construct wannabes. I knew they are useful when it is required to have an universal type for different objects but I haven’t fully grasped to scope why they are so useful otherwise. Also the fact that they can’t contain properties and only public method declarations confused me.

(more…)

Fixing other people’s code

Friday, September 22nd, 2006

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 reason for agencies trying to give such jobs but it’s save to say that the troubles of digging through the messy and often timeline-spread code is enough to justify an estimate that sounds too high for the client.

The question comes up why they don’t just ask the person who originally wrote the code! That could have many reasons but if a client comes back to me and asks me to fix something in a years old project then I’ll do it for a measly payment simply because I know my source code. It’s a total different thing to fix somebody’s code, especially if it’s pre-AS2.
I always feel uncomfortable rejecting jobs, even such ones so I would be interested how others handle this situation! Do you usually reject such jobs or do you accept them?

AS3 Short Variable/Function Names vs Long Ones

Wednesday, August 30th, 2006

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 ran a couple of quick tests to find a clear answer about this. I usually tend keep my Variable/Function names to 1-3 characters when performance really mattered but it might actually not be necessary. Consider the following test …

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package
{
	import com.hexagonstar.util.debug.Debug;
	import flash.utils.getTimer;
	import flash.display.Sprite;
 
	public class PerformanceTest extends Sprite
	{
		private var aVeryVeryLongVariableNameaVeryVeryLongVariableName:Number;
		private var num:Number;
 
		public function PerformanceTest()
		{
			var startTime:Number = getTimer();
			for (var i:int = 0; i < 4000000; i++)
			{
				aVeryVeryLongVariableNameaVeryVeryLongVariableName = (i * Math.random()) * 100;
			}
			var timeTaken:String = getTimer() - startTime + " ms";
			Debug.trace("timeTaken (long): " + timeTaken);
		}
	}
}

I’ve ran this code ten times with the 50 characters long variable name and then ten times with a 3 characters long one, both in their own SWF’s. The results ranged from 757ms to 820ms, more or less the same on both sides. The sum of the long variable version was 7924ms and the one of the three characters long one was 7903ms, not much of a difference.

The next test was similar but this time with a 50 characters long Method name and the other again with a 3 characters long one, the Methods returned a random Number for 4000000 times during this test. The results looked similar but the total sum of each test gave a 12044ms for the long name test and 15570ms for the short named one. A noticable difference of over 3 seconds. This might have been coincidence but I’ve ran the tests a couple more times and it turned out every time that the result were very close together. This is quite interesting because I was safely believing that short names would still have an advantage. It might be time to rethink this.

More Coding Fonts

Friday, July 21st, 2006

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?!

The anachronism of Assembler coding

Friday, August 22nd, 2003

I’ve been selling and buying antique computer stuff on Ebay and also managed to get an old Commodore C64G! The G model was the one with the brown bread bin case and brighter keyboard which was introduced later after the C64C model actually got sold.

This brought up some moods of nostalgia remembering the ‘good old’ days of computing and playing 8bit games. I even found some old 5 1/4″ floppy disks with old tools and games and tried to code some assembler which is even fun in a special way compared to the today’s luxury of coding applications.

There’s also now - as you might already have found - a new category named downloads in which I will put various stuff to leech down from time to time.

Besides there are still some draft entries on hold and unfinished yet on the authoring side. I’m going to finish them when I think it’s time!

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: