3 Replies Latest reply on Dec 3, 2012 1:39 PM by sinious

    Tree and Checkbox inside!


      Hi there ,


      I would have tree and check boxes inside it ! I try to set cellRenderer property but how can i get the selected checkboxes ! Is there any component !?



        • 1. Re: Tree and Checkbox inside!
          sinious Most Valuable Participant

          Did you implement your own custom cellRenderer that has CheckBox components?


          If so you'd just be iterating over all the data in the tree looking for any CheckBox components selected state set to true (the cell should report it isSelected as well, the checkbox is more of a visual aid than anything). For you to have multiple selections you'll of course need to enable multipleSelection.


          If you have some code that isn't working for you feel free to post a snippit.

          1 person found this helpful
          • 2. Re: Tree and Checkbox inside!
            miladhat Level 1

            Hi Sinious ,


            Thanks for your answer ! Let me explain further more ! I need something like this control in VS.net



            I added a checkbox on stage and converted it to Movie clip and set it's Linkage to "ch"

            then i set tree.cellRender = "ch"

            Every leaves had their checkBoxes ! But i don't know how i could find out which items are selected !


            If i can't do this i would rather make my project in VS.net ! Please Help me !


            • 3. Re: Tree and Checkbox inside!
              sinious Most Valuable Participant

              If C# (or whatever language that is) has the component you want and you only need to develop your app for windows (not the web, devices, etc) I'd suggest just going with that product if you know how to use it.


              There already is a partial CellRenderer class that can help you. If you look in the folder location the following CellRenderer API link mentions you will find a cell renderer named "CheckCellRenderer".Here's the location on Win7:

              C:\Users\USERNAME\AppData\Local\Adobe\Flash CS5.5\en_US\Configuration\Classes\mx\controls\cells\CheckCellRenderer


              Make sure you change the portions in bold/italic. The user you're currently on and if you have it set to a different language then choose the folder with the language you use.


              Here's some information on the requirements to develop a class that meets the requirements of being a CellRenderer:



              The Tree control extends the List control. The List control class should be understood as well:



              If you pointed the cellRenderer at the CheckBox component and it works then that class implements all the necessary functions mentioned above already. That only leaves traversing the Tree control which would be required.


              Are you asking how to traverse the Tree control? The Tree control itself has the methods you'll need to do it and it's exactly like traversing XML. You can just get the XML out of the Tree control with var treeXML:XML = tree.getTreeNodeAt(0). Use the available methods in a recursive way to traverse it locating each branch and check if it's selected. It's up to you to save the path to each checked item or save a list of checked items in any way you wish (an array, object, etc).