I have something working, there might be a simplier solution but that's all I have (see attachment) ;))
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
 [Embed(source="icon.gif")]
 var myIcon:String; 
 //reference to list selectedIndex
 var currentItem;
 function setSelectedIcon(event){
  var myList = event.target;
  if(currentItem!=undefined){
   //remove the icon on the previous selected item in the list dataProvider
   myList.dataProvider[currentItem].icon = null;
   }
   //set currentItem to new index
   currentItem = myList.selectedIndex;
   //update the icon property for the current item in the list dataProvider
   myList.dataProvider[myList.selectedIndex].icon = myIcon;
   //trick to redraw the list and reselect index
   myList.dataProvider = myList.dataProvider;
   myList.selectedIndex = currentItem;
   
 }
</mx:Script>
<mx:Model id="myModel">
 <item icon="" label="item1"/>
 <item icon="" label="item2"/>
</mx:Model>
<mx:List dataProvider="{myModel.item}" change="setSelectedIcon(event)"/>
</mx:Application>
 
Philippe Maegerman
Web developer

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brooks Andrus
Sent: mercredi 10 août 2005 10:34
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: selectedItem in a list shows an icon

Does the list component in Flex not have setPropertiesAt() ?  This method of the list takes two arguments:

1)       the index of the row in the list you want to modify (listen for a change event and then check the selectedIndex  property of the list).

2)       a style object which allows 2 properties of the row in question to be set-the backgroundColor (hex value) and an icon (in Flash the icon properties value would be equivalent to the linkage id of a MovieClip in the library you wished to use as an icon).

 

I hope this helps-I'm a Flash guy who lurks on the flexcoders list in a lame attempt to keep abreast of the technology.

 

Regards,

 

Brooks

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ghislain Simard
Sent: Tuesday, August 09, 2005 10:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: selectedItem in a list shows an icon

 

Is there an example you can show me...I'm not quite sure to
understand what you proposed.
Thanks

--- In flexcoders@yahoogroups.com, "JesterXL" <[EMAIL PROTECTED]> wrote:
> Use a custom cellRenderer that shows an icon when the 3rd
parameter to the
> setValue function is "selected".
>
> ----- Original Message -----
> From: "Ghislain Simard" <[EMAIL PROTECTED]>
> To: <flexcoders@yahoogroups.com>
> Sent: Tuesday, August 09, 2005 11:03 PM
> Subject: [flexcoders] selectedItem in a list shows an icon
>
>
> HI,
> How can we get a list and once an item is selected we see an icon
> appearing beside that selectedItem?
>
> thanks
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> Yahoo! Groups Links





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



YAHOO! GROUPS LINKS




------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**

This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------

Attachment: icon.gif
Description: icon.gif

Attachment: listIconSelected.mxml
Description: listIconSelected.mxml

Reply via email to