1 Reply Latest reply on Jul 14, 2009 7:34 AM by jimmyoneshot

    Filtering the objects within a tilelist via buttons

    jimmyoneshot Level 1

      At the moment I have a tilelist that is poulated by an array collection of objects (icons) and 5 buttons which are related to 5 differet categories. Each object in the icons array collerction has been given a 'category' property which as you can see is the same as each of the category buttons.

       

      What I want to happen is when each of the category button are clicked only the objects related to that specific category will be displayed with in the TileList. For example when the button labeled 'News and Sport' is clicked, only objects that have been given the category property value of "News and Sport" within the icons array collection will be displayed.

       

      How can I edit the click property of each of the buttons within the folowing code in order to do this? :-

       

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

       

      <mx:Application

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:components="components.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#545351, #E3DFDF]"

      >

       

      <mx:ArrayCollection

       

       

      id="icons"

      >

       

      <mx:Object

       

       

      id="itvPlayer" category="Entertainment" label="ITV Player"/>

       

      <mx:Object

       

       

      id="asda" category="Home Shopping" label="Asda"

      />

      <mx:Object

       

       

      id="morrisons" category="Home Shopping" label="Morrisons"

      />

      <mx:Object

       

       

      id="sainsburys" category="Home Shopping" label="Sainsburys"

      />

      <mx:Object

       

       

      id="tesco" category="Home Shopping" label="Tesco"

      />

      <mx:Object

       

       

      id="bbcLifestyle" category="Lifestyle" label="BBC Lifestyle"

      />

      <mx:Object

       

       

      id="bbcMasterchefe" category="Lifestyle" label="BBC Masterchef"

      />

      <mx:Object

       

       

      id="itv" category="News and Sport" label="ITV"

      />

      <mx:Object

       

       

      id="bbcNews" category="News and Sport" label="BBC News"

      />

      <mx:Object

       

       

      id="skyNews" category="News and Sport" label="Sky News"

      />

       

      </mx:ArrayCollection>

       

      <mx:Button

       

       

      id="LifestyleButton" click="" x="538" y="10" label="LIFESTYLE" color="#FFFFFF" fontSize="10" borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#000000, #000000]"

      />

      <mx:Button

       

       

      id="EntertainmentButton" click="" x="10" y="10" label="ENTERTAINMENT" color="#FFFFFF" fontSize="10" borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#000000, #000000]"

      />

      <mx:Button

       

       

      id="HomeShoppingButton" click="" x="418" y="10" label="HOME SHOPPING" color="#FFFFFF" fontSize="10" borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#000000, #000000]" cornerRadius="0"

      />

      <mx:Button

       

       

      id="SocialNetworkingButton" click="" x="125" y="10" label="SOCIAL NETWORKING" color="#FFFFFF" fontSize="10" borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#000000, #000000]" cornerRadius="0" width="179"

      />

      <mx:Button

       

       

      id="NewsAndSportButton" x="290" click="" y="10" label="NEWS AND SPORT" color="#FFFFFF" fontSize="10" borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#000000, #000000]" cornerRadius="0"

      />

       

      <mx:TileList

       

       

      fontWeight="bold" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="292" width="630" top="30" left="10" maxColumns="5" rowHeight="145" columnWidth="125" dataProvider="{icons}" backgroundColor="#000000" borderColor="#FFFFFF" color="#FFFFFF"

      />

       

      </mx:Application>