PDA

View Full Version : Custom component icon


guppy24
03-04-2006, 07:32 PM
I have a component, that has actionscript in the main timeline (not in an external .as file). At the top of the code, I have this:

[IconFile("componentname.png")]

Then I have an icon saved out, 18x18, transparent, etc... with the same name in the same directory as the .fla file. The component and the PNG are named the exact same.

Then I save it out as the SWC, but the icon does not come up! I look in the SWC file, and there is the standard PNG in there. How do I replace that PNG to my custom one?

I tried both the 8 bit and the 24 alpha transparency, since I read in a previous blog that they made a mistake in the documentation. Neither worked though.

All the other code works fine, like the:

[Inspectable(defaultValue=5)]
var firstNumber:Number;

Why doesn't the icon code work?
Also, does this icon come up in the library and also in the property inspector over on the left? If it does, shouldn't the icon be bigger?

Any help appreciated!

guppy24
03-04-2006, 07:43 PM
I guess I was reading the wrong instructions on the macromedia website, this will work:

1 In a graphics application, such as Macromedia Fireworks, create a bitmap image measuring 20 x 20 pixels, which represents the component. (You can also create an image in Macromedia Flash MX and save it as a PNG file.)
2 Save the bitmap.
3 In Macromedia Flash MX, open the sample component file and open the library for the component.
4 Choose File > Import to Library.
5 Select the bitmap icon image in the Import to Library dialog box and choose Open.
6 In the Library panel, create a folder named FCustomIcons.
7 Place the bitmap image inside the FCustomIcons folder.
8 Select the bitmap image inside the FCustomIcons folder, and double-click the bitmap name to edit the name.
9 Rename the bitmap image component.
The icon bitmap in the FCustomIcons folder must have exactly the same name as the component movie clip in order for the icon to function correctly.
10 Click the Close box in the upper right (Windows) or upper left (Macintosh) corner of the Library to close it. Then reopen the Library to see the custom icon displayed next to the component name.
11 Save the file.

guppy24
03-04-2006, 07:46 PM
But... when I save the component out as a SWC, the icon doesn't get packaged with it.... Anyone out there having the same problems?