Home Tutorial Flex Flex4 Components Embedding assets using style in Flex4

 
 

Share on Google+Share on Google+
Embedding assets using style in Flex4
Posted on: July 8, 2010 at 12:00 AM
Advertisement
You will use Embed() directive for specifying the source of the asset to the component.

Embedding assets using style in Flex4:

You will use Embed() directive for specifying the source of the assetto the component.
It is described in <fx:Style> tag. In this example you can see how we can use the Embed() directive in your application.
for example:

<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
mx|Button{
up-skin:Embed("C:/work/bikrant/image/redball.png");
}
</fx:Style>

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:Style>

@namespace s "library://ns.adobe.com/flex/spark";

@namespace mx "library://ns.adobe.com/flex/mx";

mx|Button{

up-skin:Embed("C:/work/bikrant/image/redball.png");

}

</fx:Style>

<s:Panel title="Embedded assets using style"

chromeColor="#555555"

color="#CCCCCC"

width="332"

height="211">

<mx:Button id="btn"

label="Button"

x="100"

y="49"

height="66"

width="128"

fontSize="20"

fontFamily="Verdana"/>

</s:Panel>

&</s:Application>

Output:/h3>

Running Application:

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

Download this code

Advertisement

Related Tags for Embedding assets using style in Flex4:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 8, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com