Chris Herring

 Flash Developer

 London

Archive for the ‘Snippets’ Category

The bit between pixels

19/10/09

A little Actionscript 3.0 function to help to find those DisplayObjects in Flash which are placed on half pixels and then snap them back into place. Although you can just leave them floating on half pixels if you want!

private function displayListSnapper(container:DisplayObjectContainer, round:Boolean, debug:Boolean, indent:String = “”):void
{
var child:DisplayObject;
for (var i:uint=0; i < [...]

 

Facebook API: Who and your App?

25/08/09

When creating a Facebook App with the Adobe Flash Facebook API, it’s pretty useful to know which of the users friends, has also added your Facebook App for scoreboards etc. A simple FacebookCall using GetAppUsers and then interpreting the returned data with GetAppUserData can yield an array of UID’s or raw XML. The code below [...]

 

Shuffle Shuffle Array

21/07/09

Some projects you find yourself needing to shuffle arrays to randomise the objects within, below is a little static function for Actionscript 3 which will do the above. In order to use the function you need to do the following…
toBeShuffledArray = ArrayShuffle.shuffle(toBeShuffledArray);

public class ArrayShuffle()
{
public static function shuffle(array:Array):Array
{
[...]