ActionScript

tips

Compiler

–optimize=true

Array

random

public function shuffle_by_splice(arr:Array):Array
{
	var brr:Array;
 
	brr = new Array();
	while (arr.length>0)
	{
		brr.push(arr.splice(Math.floor(Math.random()*arr.length),1)[0]);
	}
 
	return brr;
}

Heredoc on AS3

private var myString:String = ( <![CDATA[
				Here is my string
				that spans multiple
				lines.
				]]> ).toString();

.mxml

<mx:String id="myString">
	<![CDATA[
		Here is my string
		that spans multiple
		lines.
	]]>
</mx:String>

bitwise

Left bit shifting « multiplicando potência de 2 300% faster! xDD

x = x * 2;
x = x * 64;
x = x << 1;
x = x << 6;

Right bit shifting » dividindo potência de 2 350% faster

x = x / 2;
x = x / 64;
x = x >> 1;
x = x >> 6;

index

No index for code:as3 .

source(s)

http://dougmccune.com/blog/2007/05/15/multi-line-strings-in-actionscript-3/ http://www.gamedev.net/reference/articles/article1563.asp http://lab.polygonal.de/