2 Replies Latest reply on Jul 12, 2011 3:49 AM by Francisc

    IconItemRenderer decorator

    Francisc Level 3

      Hello,

       

      Is it possible to specify size for the decorator?

      If not, how do you set multiple sources from ActionScript?

       

      Thank you.

        • 1. Re: IconItemRenderer decorator
          Shongrunden Adobe Employee

          The decorator is designed to be an embedded asset.  If you want to provide different assets for different DPIs then consider using MultiDPIBitmapSource, for example:

           

          <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                  xmlns:s="library://ns.adobe.com/flex/spark"

                  title="Multi DPI Decorator">

           

              <s:List width="100%" height="100%">

                  <s:itemRenderer>

                      <fx:Component>

                          <s:IconItemRenderer labelField="label">

                              <s:decorator>

                                  <s:MultiDPIBitmapSource

                                      source160dpi="@Embed('../settingsIcon0.png')"

                                      source240dpi="@Embed('../settingsIcon1.png')"

                                      source320dpi="@Embed('../settingsIcon2.png')"/>

                              </s:decorator>

                          </s:IconItemRenderer>

                      </fx:Component>

                  </s:itemRenderer>

                  <s:dataProvider>

                      <s:ArrayList>

                          <s:DataItem label="0" />

                          <s:DataItem label="1" />

                          <s:DataItem label="2" />

                      </s:ArrayList>

                  </s:dataProvider>

              </s:List>

          </s:View>

          • 2. Re: IconItemRenderer decorator
            Francisc Level 3

            Thank you.

             

            I needed either to be able to set size or do what you did in AS, but I figured it out.

            Basically, you set source of the decorator to an instance of the MultiDPIBitmapSource.

             

            Should have given it more time before asking.