Mar 21 2010

AS3 snippet #4: Returning Booleans

When returning a Boolean you can do the validation inside the return statement. Usually I would do something like this:

function doTest():Boolean
{
    var returnValue:Boolean = false;
    if (someValue > otherValue) { returnValue = true; }
    return returnValue;
}

Instead, you could shorten it down to only one line of code like this:

function doTest():Boolean
{
    return (someValue > otherValue);
}

doTest will return true if someValue is greater than otherValue. Pretty neat huh?


May 25 2009

iPhone dev: Remove the glossy effect from the application icon

As you probably know, the iPhone adds a nice glossy effect to your application’s icon. It sure does look good, but sometimes it just doesn’t suit your icon. It can be prevented by editing the Info.plist file. It’s easy! Follow me.

iphone_app_01

Click on one of the lines to make the little plus icon appear. Click the plus icon to add a new line.

iphone_app_02

Give it a key name of UIPrerenderedIcon.

iphone_app_03

The value is by default set to String, but we need to change it to Boolean. Right-click the newly created line, choose Value Type > Boolean.

iphone_app_04

The value has now magically transformed into a check box.

iphone_app_05

Click it!

And you’re done. It’s as easy as that.