I have an extended Panel which has an hbox (containing buttons) 
added to the titlebar.

what i'm trying to do, is make use of the includeInLayout property 
to reposition the buttons (should i chose to make a btn 
invisible/visible).

its nearly working, except when i make a button visible again, the 
hbox container doesn't re-size again.

any ideas / help appreciated 

test.mxml - click "test" button mulitiple times
---------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*">

        <myPanel id="mypanel1"/>
        <mx:Button label="test" click="mypanel1['removeBtn2']()"/>

</mx:Application>

myPanel.mxml
------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"; width="400" 
height="300">
  <mx:Script><![CDATA[
                
  import mx.controls.Button;
  import mx.containers.HBox;
                
  private var btn1:Button;
  private var btn2:Button;
  private var btn3:Button;
                
  private var hbox1:HBox;
                
  protected override function createChildren():void
  {
    super.createChildren();
    
    hbox1 = new HBox();
                
    btn1 = new Button();
    btn1.label = "A";
    hbox1.addChild(btn1);
                                                
    btn2 = new Button();
    btn2.label = "B";
    hbox1.addChild(btn2);
                                                
    btn3 = new Button();
    btn3.label = "C";
    hbox1.addChild(btn3);
                        
    titleBar.addChild(hbox1);
  }
                
  override protected function updateDisplayList
(unscaledWidth:Number, unscaledHeight:Number):void
  {
   super.updateDisplayList(unscaledWidth, unscaledHeight);
                                        
   hbox1.setActualSize( hbox1.getExplicitOrMeasuredWidth(), 
hbox1.getExplicitOrMeasuredHeight() );

   var y:int = 4;
   var x:int = this.width - hbox1.width - 8;
                        
   hbox1.move(x, y);
  }
                
  public function removeBtn2():void
  {
    btn2.visible = (btn2.visible == true) ? false : true;
    btn2.includeInLayout = (btn2.includeInLayout == true) ? false : 
true;

    // set the size of hbox1 and get the repositioning right 
    //?????
   }

 ]]></mx:Script>        
</mx:Panel>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to