1 Reply Latest reply on Oct 4, 2010 11:34 AM by Redade

    Creating Nested Flex Components at runtime !!

    Redade

      Hello,

      I am trying to write an advanced image Gallery. I want to create categories and albums inside it . And at the runtime when user clicks the category i want to show the albums in a proper layout and the images in it too. So i need to create two components at runtime. One for albumContainer and one for Images. There can be three albums in a category and every album can have more than one image. I wrote all the functionalities for one album. I want to make it as an mxml component. My imageViewer is already a component.

      As a sample code :

                      // This DataGroup is one Album. and i need more albums in one category...

                          <s:DataGroup id="gridViewers"  width="100%" height="100%" contentBackgroundColor="#EFDFDF"

                                       horizontalCenter="center"

                                       verticalCenter="middle"

                                       >

                              <s:itemRenderer>

                                  <mx:Component>

                                      <s:ItemRenderer  horizontalCenter="center"  verticalCenter="center" >

                                          <ns1:ImageViewer imageURL="{data.imageUrl}" horizontalCenter="center"

                                                           creationComplete="parentDocument.setFilters()"          

                                                           id="imageViewer"

                                                           FileAddress = "{data.FileAddress}"

                                                           jpgFileAddress = "{data.jpgFileAddress}"

                                                           sliceNumber="{data.sliceNumber}"

                                                           bitmapScaleFactorMax="5"

                                                           bitmapScaleFactorMin=".05"

                                                           width="{data.viewerwidth}" height="{data.viewerheight}"

                                                           x="0" y="0"

                                                           />

                                      </s:ItemRenderer>

                                  </mx:Component>

                              </s:itemRenderer>

                              <s:layout>

                                  <s:TileLayout />

                              </s:layout>

                          </s:DataGroup>

       

      As you can see i have the code for one Album. But i need to create this album container in runtime with amount of the album count.

       

      I hope i could explain my problem clearly.

      Regards.