Tag Archives: actionscript

Panasonic GCS Presentation Tool

We created this presentation tool for Neutral and Panasonic to help them pitch their products to airlines. The project was a 1080p full screen application developed in Adobe AIR which was customised using an XML file and external images. The project features a clean and pleasant navigation system.

Slideshow display

Slideshow display

Sidebar Navigation

Sidebar Navigation

Rollover Fade Out

Rollover Fade Out

Rollover Hover

Rollover Hover

Handling the Back button in AIR for Android

When developing an application for Android in AIR, you may wish to override the default functionality that occurs when a user presses the Back button on their Android device. The default behavior is to exit the application completely, so in many cases it is important to handle this properly. To do so is very easy, and using AIR you can use an event listener like you would for a normal keyboard event.

Here is the code to listen for and override a Back button press on an Android device:

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown, false, 0, true)

protected function onKeyDown(event:KeyboardEvent):void
{
	if( event.keyCode == Keyboard.BACK )
	{
		event.preventDefault();
		event.stopImmediatePropagation();
		//handle the button press here. 
	}
}

Also…..happy 2012 everyone. 😉

Family Guy Trick or Treat Wheel

Family Guy Season 11 Trick or Treat cover

Family Guy Season 11 Trick or Treat cover

Last week at Substance I spent a few days working on this small Facebook app in time for the Halloween festivities. It is a small Flash app that allows users to spin a wheel, which will slow down and stop, presenting the user with a funny or rude message. I decided to use Box2D for the wheel physics to help reduce the amount of code I would need to write to create it. In hindsight, this was a bit overkill, and with slightly longer to work on the project I would have liked to have written my own physics as they would have been a lot lighter on the CPU. Unfortunately also some of the artwork supplied to me was blurry, which is noticeable on the logo, and the video is a bit grainy. However, there was not much I could do about this from a development perspective.

Family Guy Season 11 Trick or Treat Trailer

Family Guy Season 11 Trick or Treat Trailer

Users are encouraged to post this message back to their Facebook wall or share their result through Twitter to help promote the campaign virally.The application also contains a teaser video of the product and a whole host of tracking code so the client can get accurate feedback on how many people shared messages and which messages were most likely to be shared.

Head over to Facebook now to spin the Facebook Trick or Treat Wheel !

Evenly Aligning an Array of DisplayObjects.

When working with dynamic content, it is often necessary to arrange items evenly within a particular area. The following function takes an array of DisplayObjects and also the desired width they should occupy, and then spaces them out so they fit within it. I have added an optional parameter so that you can set wether the object is centered at the top left, if it is false then it assumes it is centered from the center.

private function spaceHorizontally( width:int, objects:Array, regIsTopLeft:Boolean = false ):void
		{
			//this variable defines the spacing between each item. we do it by dividing the amount of total items we are going to place by the desired size.
			var xSpacing:int = ( width / objects.length );
			var ctr:int;
			var displayObject:DisplayObject;
			
			for( ctr = 0; ctr < objects.length; ctr++)
			{
				displayObject = objects[ ctr ];
				//place the objects at the xSpacing * the current object. Then center within this area.
				displayObject.x = ((xSpacing * (ctr+1)) - xSpacing/2) 
					
					
				//this will correct the top left positioning offset 
				if( regIsTopLeft )
				{
					displayObject.x -= (displayObject.width/2);
				}	
			}
		}