flash - Disable List selection but keep childrens functions -
i got s:list dataprovider , custom itemrenderer. itemrenderer has button within. every time choose item list, focus on item, clicking button within item causes s:list select hole item , wont let me press button within item.
is there solution disable "list" selection functionallity keeping items within list enabled / clickable?
as requested, here code (relevant parts)
categorytree.mxml
<s:list id="data1" name="d1" x="-2000" height="100%" minwidth="600" width="{this.width}" dataprovider="{this.childrenresult1.lastresult}" itemrenderer="gui.components.category"> <s:layout> <s:verticallayout gap="10" clipandenablescrolling="true" variablerowheight="true"></s:verticallayout> </s:layout> </s:list>
category.mxml
<s:itemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:ns="customns" width="100%" minheight="200" height="100%" maxheight="410" autodrawbackground="false" creationcomplete="init()" updatecomplete="update()"> <s:layout> <s:horizontallayout gap="5" variablecolumnwidth="true" /> </s:layout> <s:group height="100%" width="30"> <s:bordercontainer depth="0" backgroundalpha="0.1" backgroundalpha.hovered="0.2" backgroundalpha.selected="0.4" bordervisible="false" height="100%" width="20" buttonmode="true" usehandcursor="true" click="{this.previouscategory()}" horizontalcenter="0" /> <ns:backbtn depth="1" height="30" width="30" usehandcursor="true" buttonmode="true" click="{this.previouscategory()}" alpha="0.5" alpha.hovered="1" /> </s:group> <s:hgroup width="100%" height="100%" gap="10"> <s:label height="100%" maxheight="100" maxdisplayedlines="-1" fontsize="20" rotation="-90" text="{data.name}" backgroundalpha="0.6" backgroundcolor="#6d6d6d" /> <s:list id="category" height="100%" width="100%" itemrenderer="gui.components.articlesmall" dataprovider="{this.articles}"> <s:layout> <s:tilelayout clipandenablescrolling="false" verticalgap="2" horizontalgap="5" columnalign="justifyusinggap" rowalign="top" verticalalign="middle" /> </s:layout> </s:list> </s:hgroup> <s:group height="100%" width="30"> <s:bordercontainer backgroundalpha="0.1" backgroundalpha.hovered="0.2" backgroundalpha.selected="0.4" bordervisible="false" height="100%" width="20" buttonmode="true" usehandcursor="true" click="{this.nextcategory()}" horizontalcenter="0" /> <ns:backbtn rotation="180" depth="1" height="30" width="30" usehandcursor="true" buttonmode="true" click="{this.nextcategory()}" alpha="0.5" alpha.hovered="1" /> </s:group> </s:itemrenderer>
article.mxml
<s:itemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="200" height="200" autodrawbackground="false" depth="0" depth.hovered="1" creationcomplete="init()"> <s:states> <s:state name="normal" /> <s:state name="hovered" /> <s:state name="selected" /> </s:states> <s:bordercontainer usehandcursor="true" backgroundalpha="0" bordervisible="true" width="150" height="150" left="0" top="0" borderweight="2"> <mx:image top="12.5" id="article_image" source="assets/dummy.png" autoload="true" width="100%" height="100%" x="0" scalecontent="true" /> <mx:text height="70%" width="100%" left="0.5" top="0.5" right="0.5" color="#000000" fontsize="10" text="{data.name}" /> <mx:text height="15" width="35%" bottom="0.5" left="0.5" color="#000000" fontsize="10" text="{data.prices.price() + '€'}" /> <s:bordercontainer includein="hovered" x="0" y="0" width="146" height="146" bordervisible="false" backgroundalpha="0.2" backgroundcolor="#ffffff"> <s:button id="btn_add" height="25" width="25" label="button" click="btn_add_clickhandler(event)" skinclass="gui.skins.cartadd" bottom="2" right="29" /> <s:button id="btn_del" height="25" width="25" label="button" click="btn_del_clickhandler(event)" skinclass="gui.skins.cartdel" bottom="2" right="2" /> </s:bordercontainer> </s:bordercontainer> </s:itemrenderer>
the error happens when clicking button elements within article itemrenderer. instead of clicking button, app selects "article"-item categoy.mxml list.
do need list? can datagroup instead? key difference between list , datagroup list has items selectable. if change code use datagroup, still item renderers, loose selectability.
does need?
Comments
Post a Comment