Browsing the 2009 April archive

Flexbuilder generates a HTML wrapper file by default when you run your projects. I usually turn it off while developing to save some time waiting on my browser to reload the HTML file. After disabling this setting, your application will be launched within the standalone flash player. 

Open the project properties, and select Flex Compiler properties.

picture-98

 

Uncheck Generate HTML wrapper file.
 picture-1001

Post to Twitter

Tagged with ,

Commas or spaces can be used to make reading numbers a little easier. They are placed every 3 decimal places for numbers comprising 4 digits or more. I wrote a AS3 method that returns the nicer format.

$1000000
$1 000 000

public static function separateByThousand(valueNumber : Number, splitter : String = " ") : String
{
	var valueString : String = "";
	var valueLength : Number = valueNumber.toString().length;
 
	for (var i : int = 0; i < valueLength ; i++)
	{
		if ((valueLength-i)%3 == 0 && i != 0)
			valueString += splitter;
		valueString += valueNumber.toString().charAt(i);
	}
 
	return valueString;
}

separateByThousand(1000) //1 000
separateByThousand(100000) //100 000
separateByThousand(1000000) //1 000 000
separateByThousand(1000000,”,”) //1,000,000

Post to Twitter

Tagged with , ,

It is hard to remember the whole ASCII key list when listening to keyboard events in Flash Actionscript.

Example:

I usually use the Keyboard Class (flash.ui.Keyboard) when tracking keyboard inputs but it does not contain all the keys you may want to use. Instead of googling tables with Keyboard keycodes I made this SWF to get quick access to the codes via the KeyboardEvent (flash.events.KeyboardEvent) class.

picture-96

Post to Twitter

Tagged with ,

I have missed that AS3 have a built in support for fixed point notations. This means that you can choose the number of decimals you want to output. Great!

var num:Number = 7.31343;
trace(num.toFixed(3)); // 7.313
 
var num:Number = 4;
trace(num.toFixed(2)); // 4.00

Found at livedocs

Post to Twitter

Tagged with ,

My friend Fredrick at undefined-type.com blogged about a really smart (lazy) and easy way of merging xmlfiles.

Check it out here

Post to Twitter

Tagged with , ,