Thursday, December 30, 2010

@Embed directive in Flex


@Embed directive causes flex compiler to trasncode and include images (JPG, PNG, GIF) in SWF file at compile time.
Use of this technique has following advantages

  • Images are loaded at the start of the application, so that user doesn't have to wait for images to get loaded before displaying when it is needed.
  • This technique is highly recommendate for offline application where appropriate images are included in SWF file and which will be displayed when needed instead of accessing Server for getting images
Use of this technique has one major disadvantage
  • @Embed directive increase size of SWF file.


This technique is classical example of trade-off between file size and user experience. Wisely evelaue this techniue before using it.