Note that there are some explanatory texts on larger screens.

plurals
  1. POmx:List itemrenderer acces value
    primarykey
    data
    text
    <p>I have a mx:list with custom itemrenderer.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:HBox 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="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" &gt; &lt;fx:Declarations&gt; &lt;!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). --&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ /* part with no warning [Bindable] var tName:String; override public function set data(value:Object):void { acID.text = value.id; acGlob.text = value.glob; acVisiO.text = value.visibO; acVisiV.text = value.visibV; acRoot.text = value.root; //acPhoto.source = value.photo; //acName.text = value.name; tName = value.name } override public function get data():Object { return super.data; } */ ]]&gt; &lt;/fx:Script&gt; &lt;mx:states&gt; &lt;mx:State name="normal"/&gt; &lt;mx:State name="hovered"/&gt; &lt;mx:State name="selected"/&gt; &lt;/mx:states&gt; &lt;mx:Image source="{data.photo}" width="20" height="20" alpha.hovered=".5"/&gt; &lt;mx:Label text="{data.name}" color.hovered="0x1313cd" color.selected="0x000000" color.normal="#000000" toolTip="{data.name}" /&gt; &lt;mx:Label visible="false" width="0" height="0" id="acID" /&gt; &lt;mx:Label visible="false" width="0" height="0" id="acGlob"/&gt; &lt;mx:Label visible="false" width="0" height="0" id="acVisiO"/&gt; &lt;mx:Label visible="false" width="0" height="0" id="acVisiV"/&gt; &lt;mx:Label visible="false" width="0" height="0" id="acRoot" /&gt; &lt;/mx:HBox&gt; </code></pre> <p>If I use set data function, no warning appear. But in this case I don't know how to access on itemrenderer data on doublickclik.</p> <pre><code>arrList = new ArrayList(list); listAcc = new List(); listAcc.percentHeight = 100; listAcc.percentWidth =100; listAcc.itemRenderer = new ClassFactory(irMxList); listAcc.doubleClickEnabled = true; listAcc.addEventListener(ListEvent.ITEM_DOUBLE_CLICK, onItemDoubleClick); listAcc.dataProvider = arrList; </code></pre> <p>My problem is that an error appear if I try to access on itemrenderer.data</p> <pre><code>private function onItemDoubleClick(event:ListEvent):void { var label:String = event.itemRenderer.data.name; var index:String = event.itemRenderer.data.id; var glob:String = event.itemRenderer.data.glob; var visuO:String = event.itemRenderer.data.visibO; var visuV:String = event.itemRenderer.data.visibV; var rootFile:String = event.itemRenderer.data.root; </code></pre> <p>}</p> <p>Thanks for helping</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload