3 Replies Latest reply on May 30, 2013 6:26 AM by JEEVAK CC

    get image data from an itemRenderer

    prueboblog

      Because flex embed images instead loading in realtime, I need get the image data from the itemRenderer to dinamically put a copy into other image in another place (image1.source = data-from-static-image-on-item-renderer). Is a kind of "preview the selected image bigger than the list one".

       

      My code is:

       

      <s:List id="patternList" width="{vg.width - 20}" height="73" selectedIndex="0" change="changePattern(event)">

      <s:layout>

      <s:HorizontalLayout/>

      </s:layout>

      <s:ArrayList>

                                 <fx:Object label="ninguno" value="patron00" />

                                 <fx:Object label="patron01" value="patron01" />

                                 <fx:Object label="patron02" value="patron02"  />

                                 <fx:Object label="patron03" value="patron03"  />

                                 <fx:Object label="patron04" value="patron04"  />

                                 <fx:Object label="patron05" value="patron05"  />

                                 <fx:Object label="patron06" value="patron06"  />

                                 <fx:Object label="patron07" value="patron07"  />

                                 <fx:Object label="patron08" value="patron08"  />

                                 <fx:Object label="patron09" value="patron09"  />

                                 <fx:Object label="patron10" value="patron10"  />

                                 <fx:Object label="patron11" value="patron11"  />

                                 <fx:Object label="patron12" value="patron12"  />

                                 <fx:Object label="patron13" value="patron13"  />

                                 <fx:Object label="patron14" value="patron14"  />

                                 <fx:Object label="patron15" value="patron15"  />

                                 <fx:Object label="patron16" value="patron16"  />

                                 <fx:Object label="patron17" value="patron17"  />

                                 <fx:Object label="patron18" value="patron18"  />

                                 <fx:Object label="patron19" value="patron19"  />

                                 <fx:Object label="patron20" value="patron20"  />

      </s:ArrayList>

      <s:itemRenderer>

      <fx:Component>

      <s:ItemRenderer>

      <s:VGroup horizontalAlign="center">

      <s:Image source="style/img/{data.value}.png" width="35%" height="35%" />

      <s:Label text="{data.label}" />

      </s:VGroup>

      </s:ItemRenderer>

      </fx:Component>

      </s:itemRenderer>

      </s:List>

       

      I don't know exactly what to do to do that. If someone can help me...

        • 1. Re: get image data from an itemRenderer
          DeanLoganBH Level 3

          You should probably use an ItemRender file instead of an in-line, which would give you more flexibility when you to create an image object in the data override function.

          i

          • 2. Re: get image data from an itemRenderer
            g_fields80

            Try to listen to the MouseClick event on the List. Then get the selected item index from the List and use it to get the right object in the array

            • 3. Re: get image data from an itemRenderer
              JEEVAK CC

              1.Please use dataProvider

              use like this -

              <s:List>

                                  <s:dataProvider>

                                            <s:ArrayList >

                   

              <fx:Object label="ninguno" value="patron00" />

                                         <fx:Object label="patron01" value="patron01" />

                                         <fx:Object label="patron02" value="patron02"  />

                                         <fx:Object label="patron03" value="patron03"  />

                                         <fx:Object label="patron04" value="patron04"  />

                                         <fx:Object label="patron05" value="patron05"  />

                                         <fx:Object label="patron06" value="patron06"  />

                                         <fx:Object label="patron07" value="patron07"  />

                                         <fx:Object label="patron08" value="patron08"  />

                                         <fx:Object label="patron09" value="patron09"  />

                                         <fx:Object label="patron10" value="patron10"  />

                                         <fx:Object label="patron11" value="patron11"  />

                                         <fx:Object label="patron12" value="patron12"  />

                                         <fx:Object label="patron13" value="patron13"  />

                                         <fx:Object label="patron14" value="patron14"  />

                                         <fx:Object label="patron15" value="patron15"  />

                                         <fx:Object label="patron16" value="patron16"  />

                                         <fx:Object label="patron17" value="patron17"  />

                                         <fx:Object label="patron18" value="patron18"  />

                                         <fx:Object label="patron19" value="patron19"  />

                                         <fx:Object label="patron20" value="patron20"  />

               

                                            </s:ArrayList>

                                  </s:dataProvider>

              <s:itemRenderer>

                                            <fx:Component>

               

                                                      <mx:VBox>

                                                                <s:Image source="style/img/{data.value}.png" width="35%" height="35%" />

                                                      </mx:VBox>

               

                                            </fx:Component>

                                  </s:itemRenderer>

               

                        </s:List>

               

              Please use  <mx:VBox> otherwise u got error