May 25 2009

iPhone dev: Remove the glossy effect from the application icon

Thomas Viktil

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.


May 2 2009

AS3 Snippet #3: Remove all childs

Thomas Viktil

I code snippet I tend to use quite often. And one that I tend to forget how I wrote the last time i used it.

while (this.numChildren > 0)
{
    removeChild(this.getChildAt(0));
}

Update:

And when you want to remove a child as a part of an event handler, do this:

event.target.parent.removeChild(event.target);

Let’s say you want to delete the button you just clicked. The button dispatches an event, and this line of code goes in the event handler. event.target is the button (or what ever object you clicked). It does look at bit strange, because you have to tell the button that it’s parent should delete the button. The button can’t delete itself.

Note:

If you’re working with Flex, use this.removeAllChildren(); Thank you Bjørnar :-)