본문 바로가기

Flex Tree

Tree listBaseContentHolder 사용

package tree
{
    import hebron.tinicell.components.V2Tree;
   
    import mx.automation.delegates.controls.ListBaseContentHolderAutomationImpl;
    import mx.controls.Button;
    import mx.controls.listClasses.ListBaseContentHolder; // 감춰진 클래스를 사용하기 위해 임의로 임포트;  에러안남
    import mx.core.mx_internal;
   
    use namespace mx_internal;
   
    public class AdvTestTree extends V2Tree
    {
       
        private var itemAddBtn:Button;
       
        public function AdvTestTree()
        {
            super();
   
        }
       
       
        override public function get baselinePosition():Number {
            trace("a");
            return 50;
        }
       
        protected override function createChildren():void{
            trace("top",viewMetrics.top);
            //trace(baselinePosition);
            super.createChildren();
           
            //trace("baselinePosition",super.baselinePosition);
            itemAddBtn = new Button();
            itemAddBtn.label = "test";
            itemAddBtn.visible = false;
            itemAddBtn.width = 60;
            itemAddBtn.height = 26;
            itemAddBtn.x = 3;
            itemAddBtn.y = 3;
            this.addChild(itemAddBtn);
           
           
           
        }

        Called from the <code>updateDisplayList()</code> method to adjust the size and position of
     *  listContent.

        override protected function adjustListContent(unscaledWidth:Number=-1, unscaledHeight:Number=-1):void {
            viewMetrics.top = 40;
            trace("top2",viewMetrics.top);
            super.adjustListContent(unscaledWidth, unscaledHeight);

         
  listContent.y = 50; // listBaseContentHolder 에 접근
  listContent.height -= 50;

// listContent를 사용하지 않아도 위에서 임의로 임포트한 클래스를 사용해서 listContent를 사용할 수 있다.
            var a:ListBaseContentHolder = new ListBaseContentHolder(this); // 감춰진 클래스를 임의로 임포트해서 사용가능..
           
           
        }
       

       
       
    }
}