Share on Google+Share on Google+

Embedding images in Flex4

Advertisement
You can use the any of the three methods for embedding an image with components.

Embedding images in Flex4:

You can use the any of the three methods for embedding an image with components. Flex supports JPEG, GIF and PNG images for embedding. In this example you can see how we can embedded an image with component. In this example we use a [Embed] metadata tag for embedding an image.

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/roseindia.gif")]

[Bindable]

public var imageCls:Class;

]]>

</fx:Script>

<s:Panel title="Embedding images Example"

chromeColor="#000000"

color="#CCCCCC"

width="332" height="211">

<mx:Image id="roseindiaImage"

source="{imageCls}"

x="35" y="30"/>

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

Advertisements

Advertisement

Posted on: July 8, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.