4 Replies Latest reply on Apr 28, 2010 10:07 PM by pgpradeep

    How to fire TreeEvent from ActionScript?




      I want tp fire a TreeEvent (TreeEvent.ITEM_OPEN,TreeEvent.ITEM_CLOSE,etc.) from ActionScript.

      I want to be able to open branches, double-click node(leaf),etc from ActionScript.

      Can anybody provide an example or suggest  a way to accomplish this.




        • 1. Re: How to fire TreeEvent from ActionScript?
          -skitch- Level 1

          yes, given the tree instance name "myTree"


          public var myTree:Tree = new Tree();







          in the script, do:


          myTree.addEventListener(TreeEvent.ITEM_OPEN, onItemOpen);

          myTree.addEventListener(TreeEvent.ITEM_CLOSE, onItemClose);


          protected function onItemOpen(event:TreeEvent): {




          protected function onItemClose(event:TreeEvent): {



          • 2. Re: How to fire TreeEvent from ActionScript?
            pgpradeep Level 1


            How do I select a leaf or double-click a node of the tree.

            I am using the Automation Framework and would like to use the automation object IAutomationObject to accomplish this.

            Do you happen to know about IAutomationObject.replayAutomatableEvent()?

            If you do, do you know how I can fire a TreeEvent using this function?




            • 3. Re: How to fire TreeEvent from ActionScript?
              -skitch- Level 1

              I'm not very familiar with the Automation framework, but I think you're getting your path's crossed.  You're TreeEvent should really only be tied to the tree you're working with and should be the handler for all items in the Tree.


              If you're simply trying to automate the tree opening for you...I would think that the Automation framework had some funtions to take an object and an event that should it do probably based on a timer value, but I'm not too familiar with Automation in Flex.  From here I can't really help you as I have never messed with the Automation Framework...


              I came across this in a quick google, so hopefully this helps:



              • 4. Re: How to fire TreeEvent from ActionScript?
                pgpradeep Level 1

                Thanks for the help. The automation Object is built around the actual

                object, so it is tied to the actual object in that way.

                But I cannot seem to replay the events of the actual object from the

                automation Object.

                This may be a shortcoming of the automation Object or maybe I'm not getting

                the right method of doing this.