Raymond Camden's Blog Rss

Quick AIR Tip - including an icon with your application

5

Posted in | Posted on 09-17-2008 | 3,324 views

A few nights ago I was working on a personal AIR project and wanted to include an icon with it. This was - so I thought - rather easy. I found a nice icon, saved it into an assets folder, and then edited mything-app.xml:

view plain print about
1<icon>
2<image16x16></image16x16>
3<image32x32></image32x32>
4<image48x48></image48x48>        <image128x128>assets/strogg128.png</image128x128>
5</icon>

Generating the AIR file though threw an odd error:

Um, yeah, that's nice and verbose, thanks. After some googling I knew it was icon related (and could confirm by rolling back my change to the XML file), but I couldn't figure out what was wrong. I tried moving the icon around, and tried different paths, but nothing worked.

Finally, Mike Chambers helped me out and pointed out the issue. Turns out when I have picked an icon I had only set a 128x128 icon. I was too lazy to resize the icon. Well AIR didn't like that. It thought I had specified icons for all sizes, but had used blank values for the other three sizes. This is what made AIR throw a fit. Personally I think that's a bit silly. If the value exists, but is blank, it should be treated like a null, but whatever. It was certainly non obvious to me, and I appreciate Mike helping me out. The fix I used (at first, I did end up making smaller sized icons) was to simply surround the 3 XML entries for the other icons with a comment:

view plain print about
1<icon>
2<!--
3<image16x16></image16x16>
4<image32x32></image32x32>
5<image48x48></image48x48>
6-->
        <image128x128>assets/strogg128.png</image128x128>
7</icon>

Woot. That made it build. I did end up with an issue with my 48x48 icon. Maybe I resized my graphic wrong, but I ended up not being able to build until I kept that one commented out, but I figure supporting 3 of the 4 sizes is enough for an application that will have a grand total of one user.

Comments

[Add Comment] [Subscribe to Comments]

lmao @ Um, yeah, that's nice and verbose, thanks.
You can find an error also if you have different image size in an icon node, for example you put 128 x 128 icon in 32x32 node.
Ah, I bet for my 48x48 I didn't set the size right. Flex Builder needs to help out a bit more here I think. :)
Hey I demand 4 icons....
Yeah, I've scratched my head at the icon errors as well. The compiler is picky in that regard.