Hi Tom, Here is the code for the custom component. It contains two arraylists. dataItems and selectedItems. dataItems is the complete set of list for which the check boxes should be generated. selectedItems is the list which has the items (checkboxes) to be selected. The user will send a list of completeList of items (dataItems) and a selected list of items from the main MXML.
//Code for the Custom Component <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " width="100%" autoLayout="false" horizontalScrollPolicy="off" verticalScrollPolicy="off" creationComplete="initComp()" > <mx:Script> <![CDATA[ import mx.collections.ArrayCollection= new ArrayCollection(); [Bindable] public var dataItems:ArrayCollection = new ArrayCollection(); [Bindable] public var selectedItems:ArrayCollection; ]]> </mx:Script> <mx:Tile id="chkTile" > <mx:Repeater id="chkRepeater" dataProvider="{dataItems}"> <mx:CheckBox id="chkCheckBox" selected="selectedItems.contains(chkRepeater.currentItem)" label="{chkRepeater.currentItem.label}" styleName="glass" uid="{chkRepeater.currentItem.value}" /> </mx:Repeater> </mx:Tile> </mx:Canvas> //Code for the Main MXML <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initComp()" xmlns:view="view.*"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var completeList:ArrayCollection = new ArrayCollection(); [Bindable] private var selectedList:ArrayCollection; private function initComp(){ //Assume that I will get a list of Items (checkBoxes in this case) to be created completeList = ...... } ]]> </mx:Script> <view:MultipleOptionsCheckBoxView dataItems="{completeList}" selectedItems="{selectedList}"/> </mx:Application> I am binding completeList to dataItems and selectedList to selectedItems. My ultimate goal is, if the developer passes a list of selectedList then the checkboxes should be selected (after creation) based on the items the developer passed. If the developer doesn't pass anything, then when ever a user selects a list of items, they should be available to the developer in the local variable selectedList (as there is a binding). I think you understoood my requirement. Everything works fine for me except when the selectedList (local variable in the Main.mxml) is not initialized. If I initialize this local variable, then the binding works fine (both sides). If I have a list of selectedList, then also the binding works. The only problem is when the selectedList is null. If I initialize the variable in the custom component (when it is null) the binding fails. I dont want to use <mx:Binding> tag (which also works fine in all situations)... Let me know if I miss anything....or confused you a lot.......... Once again, thanks for your help.... Madhu --- In flexcoders@yahoogroups.com, Tom Chiverton <[EMAIL PROTECTED]> wrote: > > On Friday 23 Mar 2007, madhukiranm wrote: > > Thanks for the reply....I tried the one you suggested, but binding > > doesn't seem to work..... > > Guess you'll have to post your code then :-) > > > -- > Tom Chiverton > Helping to administratively entrench interactive convergence > On: http://thefalken.livejournal.com > > **************************************************** > > This email is sent for and on behalf of Halliwells LLP. > > Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. > > CONFIDENTIALITY > > This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. > > For more information about Halliwells LLP visit www.halliwells.com. >