In this example you can see how we can use the view state in custom component.
In this example you can see how we can use the view state in custom component.In this example you can see how we can use the view state in custom component. You will use this component in your main application through itemrenderer property.
|
<?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">chromeColor=" #333333"color=" #CCCCCC" width="348" height="438">width=" 300" height="376" x="18" y="19"> <s:layout>requestedColumnCount=" 2" requestedRowCount="2" /> </s:layout>name=" Iphone"data=" 1"price=" 129.99$"image=" @Embed('C:/work/bikrant/image/iphone.png')"description=" More flexible"/> <fx:Objectname= " Mobile"data=" 1"price=" 99.99$"image=" @Embed('C:/work/bikrant/image/orbit.png')"description=" Gift for a friend."/> <fx:Objectname=" MP3 player"data=" 1"price=" 49.99$"image=" @Embed('C:/work/bikrant/image/player.png')"description=" For listening music"/> <fx:Objectname=" Compass"data=" 1"price=" 19.99$"image=" @Embed('C:/work/bikrant/image/compass.png')"description=" For direction"/> </mx:ArrayCollection> </s:DataGroup></s:Application> |
|
<?xml version="1.0" encoding="utf-8"?> <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:mx=" library://ns.adobe.com/flex/mx"xmlns:s=" library://ns.adobe.com/flex/spark">source=" {data.image}"width=" 100" width.hovered="128"height=" 100" height.hovered="128"/>color=" blue"fontSize.hovered=" 16"/>fontWeight.hovered="bold"/> <s:Label text.hovered="{data.description}" color="red"/></s:ItemRenderer> |

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.
Download mainapplication.mxml file code
Download itemrenderer.mxml file code