Subscribe to RSS
get email updates
home | about | pixDif AIR app | video tutorials
polyGeek.com

Register for 360Flex in DC using the ad below and you will automatically be entered in a drawing for a free ticket. Read more.
place your ad here

Web Premium





Putting all your icons in one basket

December 8th, 2008 . by polygeek

You know the saying, “Don’t put all your eggs in one basket?” Well, that person didn’t have to keep track of a bazillion icons in one of their apps.

view source

The icons here are loaded as assets of a CSS class selector .icon

.icons {
Actionscript: Embed( 'assets/icons/Actionscript.png' );
AIR: Embed( 'assets/icons/AIR.png' );
AMF: Embed( 'assets/icons/AMFPHP.png' );
Flash: Embed( 'assets/icons/Flash.png' );
Flex: Embed( 'assets/icons/Flex.png' );
FMS: Embed( 'assets/icons/FlashMediaServer.png' );
Photoshop: Embed( 'assets/icons/Photoshop.png' );
}

Then the RadioButtons just change the icon by using the StyleManager as such:

private function onRadioBtnChange( e:Event ):void {
var selectedIcon:String = e.target.selectedValue
iconBtn.setStyle( 'icon',
StyleManager.getStyleDeclaration('.icons').getStyle( selectedIcon ) );
iconBtn.label = selectedIcon;
}

With this approach you could put all your icons in one external CSS file and then just pick from the bunch as needed. I came across this tid-bit from the book Creating Visual Experiences with Flex 3.0, page 80.

If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.

Post to Twitter Post to Delicious Post to Facebook Post to Reddit Post to StumbleUpon


similar posts

One Response to “Putting all your icons in one basket”



[...] then use the StyleManager to set the specific value of each Image. I’ve found that it’s a handy way of manage assets. ( Thanks to Juan Sanchez and Any McIntosh Creating Visual Experiences with Flex 3.0 for the tip. [...]

   Welcome back (Change)

Leave a Reply

comment feed RSS   subscribe to this comment thread

Recent Posts

   



polyGeek.com

© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites
Local Directory for Los Angeles, CA

Better Tag Cloud