Home Tutorial Flex Flex4 Components Embedding assets in MXML in Flex4

 
 

Embedding assets in MXML in Flex4
Posted on: July 8, 2010 at 12:00 AM
You will use @Embed() directive in mxml tag for providing the location of component.

Embedding assets in MXML in Flex4:

You will use @Embed() directive in mxml tag for providing the location of component. In this example you can see how we can use the @Embed() directive with component in your application.
for example:
<mx:Image id="GlobeImage" source="@Embed(source='C:/work/bikrant/image/yellowglobe.png')"/>

Example:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

minWidth="955" minHeight="600">

<s:Panel title="Embedding assets in MXML"

chromeColor="#000000"

color="#CCCCCC"

width="332" height="211">

<mx:Image id="GlobeImage"

source="@Embed(source='C:/work/bikrant/image/yellowglobe.png')"

x="108" y="29"/>

</s:Panel>

</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Related Tags for Embedding assets in MXML in Flex4:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.