Hi Hemavaan,
see this code
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
[Embed(source="icons/male.png")]
public var male:Class;
[Bindable]
[Embed(source="icons/female.png")]
public var female:Class;
override public function set data(value:Object):void
{
if(value != null)
{
super.data = value;
if(data.Gender == "Male")
{
MaleFemaleIcon.source = new male();
}
else
{
MaleFemaleIcon.source = new female();
}
}
}
]]>
</mx:Script>
<mx:Spacer width="20%"/>
<mx:Image id="MaleFemaleIcon"/>
</mx:VBox>
On Sat, Apr 18, 2009 at 12:02 AM, Hemavaan KKH <[email protected]> wrote:
> hi friends,
>
> I have same problem. i don't what can i do. if u wish plz send source file.
>
> Thanks&Regards in advance
> Hemi (KKH)
> +91-9865177899
>
>
> On Fri, Apr 17, 2009 at 7:29 PM, sankar swaroop <[email protected]>wrote:
>
>> Thanks Ravi.
>> you helped alot
>> Thank u very much
>>
>>
>> On Fri, Apr 17, 2009 at 10:52 AM, Ravi Mishra <[email protected]>wrote:
>>
>>>
>>> Hi Sankar,
>>>
>>> Dont override the UpdateDisplayList method here. For itemrenderer you
>>> need to overried the set data method and then write your logic there
>>>
>>> override public function set data(value:Object):void{
>>> super.data = value;
>>> if(value.Gender == "Male"){
>>> //male icon
>>> }
>>> else{
>>> //female Icon
>>> }
>>> }
>>>
>>> HTH,
>>>
>>> -Ravi
>>>
>>> On Apr 16, 7:33 pm, sankar swaroop <[email protected]> wrote:
>>> > Hi friends,
>>> >
>>> > i am displaying gender in grid as Male and Female.
>>> > But now i want to display male and female as icons like
>>> > based on the condition if male it needs to display one icon
>>> > and if female another icon should be displayed.
>>> >
>>> > I created itemrenderer to that like below:
>>> >
>>> > *
>>> >
>>> > package*{
>>> >
>>> > **
>>> >
>>> > *import* mx.controls.Image;
>>> >
>>> > *public* *class* GenderIcons *extends* Image
>>> >
>>> > {
>>> >
>>> > **
>>> >
>>> > [*Bindable*]
>>> >
>>> > [*Embed*(source=*'icons/male.png'*)]
>>> >
>>> > *public* *var* male:Class;
>>> >
>>> > [*Bindable*]
>>> >
>>> > [*Embed*(source=*'icons/female.png'*)]
>>> >
>>> > *public* *var* female:Class;
>>> >
>>> > *override* *protected* *function*
>>> updateDisplayList(unscaledWidth:Number,
>>> > unscaledHeight:Number):*void
>>> > *
>>> >
>>> > {
>>> >
>>> > *super*.updateDisplayList(unscaledWidth,unscaledHeight);
>>> >
>>> > setStyle(*"icon"*,(da...@gender == *"Male"*)?male:female);
>>> >
>>> > }
>>> > }
>>> > }
>>> >
>>> > But it is not displaying anything. Is there any error in code
>>> >
>>> > Please help me
>>> >
>>> > Thanks in advance
>>> >
>>> > Bye....
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---