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 setthe 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 helpsIm 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 SPONSORED LINKS Computer software testing Macromedia flex Development Software developer YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Re: selectedItem in a list shows an icon
I have something working, there might be a simplier solution but that's all Ihave (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 selectedIndexvar currentItem;function setSelectedIcon(event){var myList = event.target;if(currentItem!=undefined){//remove the icon on the previous selected item in the list dataProvidermyList.dataProvider[currentItem].icon = null;}//set currentItem to new indexcurrentItem = myList.selectedIndex;//update the icon property for the current item in the list dataProvidermyList.dataProvider[myList.selectedIndex].icon = myIcon;//trick to redraw the list and reselect indexmyList.dataProvider = myList.dataProvider;myList.selectedIndex = currentItem;}/mx:Scriptmx:Model id="myModel"item icon="" label="item1"/item icon="" label="item2"//mx:Modelmx:List dataProvider="{myModel.item}" change="setSelectedIcon(event)"//mx:Application Philippe Maegerman Webdeveloper From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brooks AndrusSent: mercredi 10 août 2005 10:34To: flexcoders@yahoogroups.comSubject: 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 SimardSent: Tuesday, August 09, 2005 10:06 PMTo: flexcoders@yahoogroups.comSubject: [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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --**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.-- icon.gif Description: icon.gif listIconSelected.mxml Description: listIconSelected.mxml
[flexcoders] Re: selectedItem in a list shows an icon
Very close to what I need...How to change the image if I click back on the same item. The idea is that I want to permit no selection in the list. Thanks --- In flexcoders@yahoogroups.com, Niklas Richardson [EMAIL PROTECTED] wrote: Hi Guys, I started going down the same root as Philippe, but I think using the isSelected and setPropertiesAt might be a bit cleaner. Here's the code below. You can also see it in action here: http://flexdemos.prismix.com/samples/blog_examples/listIcons.mxml? versionChecked=true The only downside I see is that you need to loop through all items in the list. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; width=250 height=425 mx:Script ![CDATA[ [Embed(source=assets/icons/small/add.png)] var activeIcon:String; [Embed(source=assets/icons/small/delete.png)] var inActiveIcon:String; function toggleIcons(event) { var listControl = event.target; var activeObject = {icon: activeIcon}; var inActiveObject = {icon: inActiveIcon}; // Reset Icons for (var i in listControl.dataProvider) { if (listControl.isSelected(i)) listControl.setPropertiesAt (i, activeObject); else listControl.setPropertiesAt (i, inActiveObject); } } ]] /mx:Script mx:Text text=Single Selection / mx:List id=theList width=200 change=toggleIcons(event) creationComplete=toggleIcons(event) mx:dataProvider mx:Array mx:Object label=Item 1 icon={inActiveIcon} / mx:Object label=Item 2 icon={inActiveIcon} / mx:Object label=Item 3 icon={inActiveIcon} / mx:Object label=Item 4 icon={inActiveIcon} / /mx:Array /mx:dataProvider /mx:List mx:Text text=Multiple Selection / mx:List id=theOtherList width=200 change=toggleIcons (event) multipleSelection=true creationComplete=toggleIcons(event) mx:dataProvider mx:Array mx:Object label=Item 1 icon={inActiveIcon} / mx:Object label=Item 2 icon={inActiveIcon} / mx:Object label=Item 3 icon={inActiveIcon} / mx:Object label=Item 4 icon={inActiveIcon} / /mx:Array /mx:dataProvider /mx:List /mx:Application Cheers Niklas On 10/08/05, Philippe Maegerman [EMAIL PROTECTED] wrote: 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
RE: [flexcoders] Re: selectedItem in a list shows an icon
Very close to what I need...How to change the image if I click back on the same item. The idea is that I want to permit no selection in the list. Holding down the Ctrl key while clicking does it. Otherwise, you might need to write your own toggle function called by a click event. Blake Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hl37u6e/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123709257/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy/a./font ~- -- 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 * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[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 Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12h7bi8jj/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123653987/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 Fair play? Video games influencing politics. Click and talk back!/a./font ~- -- 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 * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/