Embedded assets using Actionscript in Flex4


 

Embedded assets using Actionscript in Flex4

You will use [Embed] metadata tag for specifying the source of the asset to the component.

You will use [Embed] metadata tag for specifying the source of the asset to the component.

Embedded assets using Actionscript in Flex4:

You will use [Embed] metadata tag for specifying the source of the asset to the component. It is described in Actionscript file or <fx:Script> tag. In this example you can see how we can use the [Embed] metadata tag in your application.
for example:

<fx:Script>
<![CDATA[
[Embed(source="C:/work/bikrant/image/green.png")]
[Bindable]
public var imageCls:Class;
]]>
</fx:Script>

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">

<fx:Script>

<![CDATA[

[Embed(source="C:/work/bikrant/image/green.png")]

[Bindable]

public var imageCls:Class;

]]>

</fx:Script>

<s:Panel title="Embedding assets using Actionscript"

chromeColor="#555555"

color="#CCCCCC"

width="332"

height="211">

<mx:Button id="btn"

label="Green"

icon="{imageCls}"

x="113" y="61"

height="28" width="105"/>

</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

Ads