Item renderer in flex

Item renderer in flex

Hi.....

I have a problem
How do you call a method in particular ItemRenderer. Also the ItemRenderer is your own Custom Component?

please give me an example for that......

Thanks

View Answers

October 21, 2010 at 11:09 AM

Ans:

I think this is pretty good example for you. Please check this.

Itemrenderer.mxml

<?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"
    autoDrawBackground="false">

    <fx:Script>
        <![CDATA[

            [Bindable]
            public var myBGColor:int = 0xFFFFFF;

            override public function set itemIndex(value:int):void { 
                if ((value%2) == 0) {
                    myBGColor= 0xFFFFFF;
                }
                if ((value%2) == 1) {
                    myBGColor= 0xCCFF66;
                }
            }
        ]]>
    </fx:Script>

    <s:states> 
        <s:State name="normal"/> 
        <s:State name="hovered"/> 
    </s:states> 

    <s:Rect id="myRect" 
        left="0" right="0" top="0" bottom="0" 
        alpha="1.0"> 
        <s:stroke> 
            <s:SolidColorStroke 
                color="0xA8C6EE" 
                weight="1"/> 
        </s:stroke> 
        <s:fill> 
            <s:SolidColor
                color="{myBGColor}"/> 
        </s:fill> 
    </s:Rect>     

    <s:Label id="labelDisplay" 
        verticalCenter="0" 
        left="3" right="3" top="6" bottom="4" 
        fontSize.hovered='14' fontStyle.hovered="italic"/> 
</s:ItemRenderer>

main.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:s="library://ns.adobe.com/flex/spark">

    <s:SkinnableDataContainer 
        itemRenderer="myComponents.MyAlternatingItemRenderer"> 
        <s:layout>
            <s:VerticalLayout/>
        </s:layout>
        <mx:ArrayList>
            <fx:String>Bill Smith</fx:String>
            <fx:String>Dave Jones</fx:String>
            <fx:String>Mary Davis</fx:String>
            <fx:String>Debbie Cooper</fx:String>
        </mx:ArrayList> 
    </s:SkinnableDataContainer> 
</s:Application>









Related Tutorials/Questions & Answers:
Item renderer in flex
Item renderer in flex  Hi...... please tell me about How to create item renderers in flex? give an example for that Thanks
Item renderer in flex
Item renderer in flex  Hi..... How does item renderer work? How do I add item renderer at runtime? Please me the right answer so i cam... itemrendrer at run time: Very first you will create a basic item renderer. Now i have
Advertisements
Item renderer in flex
Item renderer in flex  Hi... Please tell me about what does listData contain in ItemRenderers? What is the Type of listData? please give an example for that........ Thanks
Item renderer in flex
Item renderer in flex  Hi..... I have a problem How do you call a method in particular ItemRenderer. Also the ItemRenderer is your own Custom Component? please give me an example for that...... Thanks
Item Renderer in AdvancedDataGrid
Item Renderer in AdvancedDataGrid: In this example you can see how we can use a item renderer property in AdvanceddataGrid control. The tag of item... a pie chart as a item renderer and displayed in AdvancedDataGrid. ADS
HorizontalList in Flex
Flex HorizontalList HorizontalList is used to display a list in horizontal manner. The HorizontalList is useful when we use item renderer... to display all the items in the list. User can select more than one item
Not Able to select an Item in Spark Combo Box control (Adobe Flex Object) using QTP
Not Able to select an Item in Spark Combo Box control (Adobe Flex Object) using QTP  Hi, I am trying to Automate a website developed using Adobe Flex controls. But i am not able to select any item from Spark Combo Box. I tied
Flex ClassFactory
of a DataGrid control. When we change the item renderer at run time then we have to need...Flex ClassFactory   Hi.... What is ClassFactory and why...;factory object" which Flex uses to generate instances of another class
item lookup
item lookup  I need to create a lookup box in a grid that searches and filters at the same time. Upon selection the item with its price should be displayed. The control would then position below the first selection, so
How to change object item to integer item
How to change object item to integer item  How to change objectitem to integer item?thankyou
return item in jquery
return item in jquery  How to return items/variables in JQuery?   See the code below to find out how to return an Item in Jquery: function findItem() { var item; while(if_item_not_found) { // search
Flex Looping
Flex Looping  I need example for flex looping mechanisam example
Flex - Framework
Flex  database conectivity in flex
delete an item from database
delete an item from database  how to delete an item from the database using jsp
ModuleNotFoundError: No module named 'item'
ModuleNotFoundError: No module named 'item'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'item' How to remove the ModuleNotFoundError: No module named 'item' error
View state with a custom item renderer in Flex4
View state with a custom item renderer in Flex4: In this example you can see..." ADS_TO_REPLACE_1 xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="
doubt in combobox in flex - XML
in flex which is a combination of mxml and actioscript . In my project i has a combobox with 10 items when i select the particular item i has 2 display the particular information abt the item in the same page .pls provide the codings
Flex Combobox
Flex Combobox  flex combobox with database as dataprovider   You can visit the following link for detailed tutorial on the topic. May this will be helpful to you. http://www.roseindia.net/flex/flex-combo-box.shtml
ModuleNotFoundError: No module named 'renderer'
ModuleNotFoundError: No module named 'renderer'  Hi, My Python... 'renderer' How to remove the ModuleNotFoundError: No module named 'renderer... to install padas library. You can install renderer python with following
Flex basic
Flex basic  Hi...... please just tell me about Can we run Flex applications in MAC? Thanks
Flex and Java
Flex and Java  hi..... Please give similiarities between Java and Flex. Thanks
Flex event
Flex event  Hi.... Please tell me about How to create your own event in flex? Thanks
navigation item back button
navigation item back button  I wants to add a navigationBar on the top of my UIWebView also a navigation item "back button". can anyone please explain how the back and refresh button works
Flex and Java
Flex and Java  Hi...... Give the name of Collection which can be mapped to java and Flex and vice-versa. please give the name of all collections which is used in flex and java.. Thanks
Flex and Java
Flex and Java  Hi.... What are the config files that are used to connect Java and Flex applications? Please provide the solution of this prob so i connect java and flex.... Thanks
Flex as a Service
Flex as a Service  Hi....... just tell me about How do I run Flex as a service? please give me an example if possible Thanks  Ans: Flex is not a server. It is the pert of your web application. you can use
Flex Updates
Flex Updates  Sir, first Thanks For Good Resource for Every One! i am New to Flex... but,in Current Updates Tell Us Flex Becomes To down!(Sorry To say).. May I know Future groom & Advantage of Flex Over Other Web
Flex basic
Flex basic  Hi.......... I want to know about What is localToGlobal and globalToLocal in flex? please give me ans ASAP..... Thanks
Flex application
Flex application  Hi..... What kind of applications you can create from flex? please give the name of these applications....... Thanks
Flex basic
Flex basic  Hi.... can you tell me about Is Flex OS specific or operating system independent? please give the description about it....... Thanks
Flex basic
Flex basic  Hi.... I want to know Do we need any plugins to run Flex applications? please give the ans ASAP....... Thanks
Flex difference
Flex difference  Hi.... please tell me about What is the difference between Flex 2.0 and Flex 3.0? Thanks  Ans: There are some advantages of Flex3.0 over Flex 2.0 they are following: 1. Faster compilation time
Drag Manager in flex
an object, such as an item in a List control or a Flex control, such as an Image...Drag Manager in flex  HI... Please tell me about What is a drag manager in flex? Give me the answer with example Thanks  Ans
Adding a flex table in another flex table column
Adding a flex table in another flex table column  how to add a flex table in another flex table column
Flex basic
Flex basic  Hi.... Can flex application communicate with each other on the client? please give me the answer ASAP.....ADS_TO_REPLACE_1 Thanks   Ans: See the LocalConnection API In the flex documentation. ADS
Flex with JSP
Flex with JSP  i want to draw chart in jsp page using flex. how can i do that? any solution??   Flex charts You can visit the following links: http://www.roseindia.net/tutorial/flex/flex4/components/charteffect.html
Flex basic
Flex basic  Hi...... Please tell me about What are non-visual components in flex? What class do they extend? please give the name of these components....... Thanks
highlight menu item html
highlight menu item html  highlight menu item in html or CSS   <body id="index"> <div id="menu"> <ul> <li class="index" ><a href="index.html">Index page</a></li> <
Flex Managers
Flex Managers  Hi... Please tell me about How to override Managers? give me an example for that.... Thanks
Image in Flex
Image in Flex  Hi..... Can you manipulate images using Flex programs? please give me the example....... Thanks
Flex event
Flex event  hi...... How to capture and event if the component is disabled? please give an example..... Thanks in advance
Metadata in flex
Metadata in flex  Hi......... please tell me about the meta data in flex. Thanks
XML in flex
XML in flex  Hi... just tell me about What is e4X and XML in flex? Thanks
Mask in Flex
Mask in Flex  Hi...... Is it possible to create 'gradient mask' in flex? please give me the ans ASAP..... Thanks in advance
Adobe flex
Adobe flex  Hi... please give me the description about What is Adobe Flex? Thanks
Advantage of Flex
are the Advantages and Disadvantages of flex? Thanks   Advantages: Flex IDE is very capable. Flex output is a movie and images is the major part of this movie. you can not directly download the flex running file. When we right click
Flex event
Flex event  Hi.... please tell me about How does Flex event...: In the capturing phase, Flex examines an event target?s ancestors in the display list to see...: In the targeting phase, Flex invokes the event dispatcher?s listeners. No other nodes
unique value renderer
unique value renderer   i want to develop an unique value renderer based on user choice and choices are provided in selectonemenu tag of jsf.i am using an arcgis 10 service to develop this web application(in netbeans ide 6.9
Output of flex
Output of flex  hi....... please provide the name of the output file. What is the output of flex applications? please rply ASAP........ Thanks
FLex basic
FLex basic  Hi..... I want to know about What is the difference between DisplayObjectContainer and DisplayObject? please give an ans ASAP..... Thanks

Ads