tags:

views:

604

answers:

1

how to refer an image in flex that have been included in the swc file ?

A: 

Use the Embed metadata tag. Something like:

source="@Embed(source='relativeOrAbsolutePath')"

The syntax for embedding resources is given here:

The syntax that you use for embedding assets depends on where in your application you >embed the asset. Flex supports the following syntaxes:

* [Embed(parameter1, paramater2, ...)] metadata tag

  You use this syntax to embed an asset in an ActionScript file, or in an <mx:Script> block in an MXML file. For more information, see Using the [Embed] metadata tag.
* @Embed(parameter1, paramater2, ...) directive

  You use this syntax in an MXML tag definition to embed an asset. For more information, see Using the @Embed() directive in MXML.
* Embed(parameter1, paramater2, ...) directive

  You use this syntax in an <mx:Style> block in an MXML file to embed an asset. For more information, see Embedding assets in style sheets.

All three varieties of the embed syntax let you access the same assets; the only difference is where you use them in your application.

Read the section on loading resources from the documentation. Also, Embedded Asset Classes.

dirkgently