čtvrtek 4. února 2010

Flex: Setting 'source' property of Image object in CSS

By default, source property of Image class cannot be set in CSS file. But there is a workaround:

Define new class (StyledImage.mxml):

<mx:Image xmlns:mx="http://www.adobe.com/2006/mxml" source="{this.getStyle('source')}">
</mx:Image>


Now, you can insert an image with source defined in CSS file into your application:

<components:StyledImage styleName="messagesIcon"/>


And set the source in CSS file:

.messagesIcon {
source: Embed(source='image.png');
}


Inspiration: http://old.nabble.com/Can-I-set-the-image-source-in-CSS--td18968426.html

Žádné komentáře:

Okomentovat