All Posts in Code Sample

March 12, 2014 - No Comments!

Play Background Music in Your IOS App

Something often overlooked is how your app integrates to the user's mobile experience. When listening to music and interacting with other apps, it can be a bad user experience for the user's audio experience to be cut off when your app has no use for a focused audio experience.

Here's a short code snippet to allow your user to play background music in your IOS App...

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];

February 25, 2014 - No Comments!

Open Game Center Preferences from within your IOS App

So we all know Game Center isn't ideal - if user's don't login at install time it can be hard to get them to login whilst within your app. Game Center is designed to stop presenting the Game Center login view after the user has dismissed it a few times. Short of giving the user clear instructions to login once this has occurred there isn't really any ideal solution to get your user to login once they have decided to do so.

Read more

May 16, 2013 - No Comments!

Lifelike gravity with Accelerometer in Cocos2D + Box2D, Xcode Sample

Small code snippet reference for getting lifelike gravity from your accelerometer in your projects. This is for Cocos2D and Box2D but is easily changeable to your project needs whichever language you program in.

- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
{
b2Vec2 gravity ( 9.8 * acceleration.x, acceleration.y * 9.8);
world->SetGravity(gravity);
}

March 27, 2013 - No Comments!

Wordwrap between Textfields AS3

On a project we're currently working on I was required to animate character input using sprite sheets to handle the animation of the characters. This was done by using textfields hidden to the user and animating their input. One of the features required was wordwrap so here is a simple way to create the appearance of wordwrapping between 2 separate fields...

Read more

January 13, 2012 - No Comments!

Flash Bug: Flash HTMLText Jumps on RollOver

Working on a project where the html text of a field would appear to jump/ contract on rollover. It appears the issue occurs when a dynamic textfield has autoSize set to true. There is a simple fix by setting autoSize to false after the text has been set.This may play with the height of the textfield if it is dynamically sizing so to fix this I add in the following code...

Read more