1 Reply Latest reply on Oct 7, 2010 1:38 AM by JabbyPandaUA

    Layout tile in a mx:Repeater

    leonapster

      Here's my code.

       

      I want diplay images in a layout tile. What's wrong?

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Group 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:Property="components.Property.*"

      creationComplete="initApp()"

      width="788" height="227">

       

      <s:layout>

      <s:VerticalLayout/>

      </s:layout>

       

      <fx:Declarations>

       

      <s:HTTPService id="buildsService" url="http://preventivi-viaggi.it/flex/api/GetData.php?table=buildsTypes"

         result="buildsService_resultHandler(event)" showBusyCursor="true"/>

       

      </fx:Declarations>

       

      <fx:Script>

      <![CDATA[

      import mx.collections.ArrayCollection;

      import mx.events.CloseEvent;

      import mx.managers.PopUpManager;

      import mx.rpc.events.ResultEvent;

      import mx.utils.ObjectProxy;

       

       

      [Bindable]

      private var ListOfBuilds:ArrayCollection;

       

      private function initApp():void

      {

      buildsService.send();

      }

       

      private function closeWindow(e:CloseEvent):void {

      PopUpManager.removePopUp(this);

      }

       

      protected function buildsService_resultHandler(event:ResultEvent):void

      {

      if(event.result.buildsTypes.buildsType is ArrayCollection){

      ListOfBuilds = event.result.buildsTypes.buildsType as ArrayCollection;

      }else if(event.result.buildsTypes.buildsType is ObjectProxy){

      ListOfBuilds  = new ArrayCollection([event.result.buildsTypes.buildsType]);

      }

      }

      ]]>

      </fx:Script>

       

       

      <s:Label text="Employee Directory"

      color="#0B85B7"

      fontSize="36"

      fontStyle="normal"

      fontWeight="normal"/>

       

      <s:BorderContainer borderColor="#0b85b7"

         cornerRadius="8"

         borderWeight="4">

       

      <s:Group id="employeeGroup"

      height="300" width="450">

       

      <!--

      The layout property here is a property of the Group container.

      Its value is the TileLayout class, which directs the Group container

      to lay out all of its child UI elements, in this case the EmployeeDisplay

      custom component instances, in a tiled layout.

      -->

       

      <s:layout>

      <s:TileLayout/>

      </s:layout>

      <mx:VBox verticalGap="0">

      <mx:Repeater id="rptImages" recycleChildren="true" dataProvider="{ListOfBuilds}">

      <Property:PropertyTypeImage Name="{rptImages.currentItem.name}" Source="{rptImages.currentItem.image}" />

      </mx:Repeater>

      </mx:VBox>

      </s:Group>

       

      <s:Scroller viewport="{employeeGroup}"/>

       

      </s:BorderContainer>

      </s:Group>