Skip navigation

One easy way to organize your asset library.

This has always been a nice way (for me) to have access to your image files – from one class. Easy to update and maintain. Note that by using static const you won’t get binding warnings throughout your application.

package assets.images
{
	public class ImageAssets
	{
		[Embed(source="check_icon.png")]
		public static const CHECK_ICON : Class;

		[Embed(source="warning_icon.png")]
		public static const WARNING_ICON : Class;

		[Embed(source="info_icon.png")]
		public static const INFO_ICON : Class;
	}
}

Useage:

import assets.images.ImageAssets;
<mx:Image source="{ImageAssets.INFO_ICON}" />
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: