0 Replies Latest reply on Sep 10, 2008 9:11 AM by AJC5327

    Accessing Close button in TitleWindow

    AJC5327
      Hi all,
      I have a situation where I'm adding buttons to a TitleWindow chrome. They co-exist with the close button provided by the panel. I create classes for my button images and then I size the buttons to fit the image.

      I also set the styles for the panel-provided close button with classes. My goal was to have all the buttons look & feel the same.

      Excerpt from application mxmxl ...
      <mx:Style>
      TitleWindow {
      backgroundColor: #333333;
      closeButtonDisabledSkin: Embed("assets/close.png");
      closeButtonDownSkin: Embed("assets/closeDown.png");
      closeButtonOverSkin: Embed("assets/closeDown.png");
      closeButtonUpSkin: Embed("assets/closeUp.png");
      }
      </mx:Style>

      <v:ResizeWindow id="testResizeWindow"
      height="50%"
      width="50%"
      title="Resize Window"
      useWindowButtons="true"
      status=""
      showCloseButton="true"
      restoreWindow="this.currentState=''"
      maximizeWindow="this.currentState='maximized'"
      minimizeWindow="this.currentState='minimized'"
      close="popUp('Close button clicked')">
      </v:ResizeWindow>

      Excerpt from my ResizeWindow class ...
      override protected function createChildren():void{
      super.createChildren();
      if(useWindowButtons){
      if(btnMinimize == null){
      btnMinimize = new Button();
      var btnMinimizeImageObj:BitmapAsset = new btnMinimizeUpSkin() as BitmapAsset;
      btnMinimize.width = btnMinimizeImageObj.width;
      btnMinimize.height = btnMinimizeImageObj.height;

      btnMinimize.setStyle("upSkin", btnMinimizeUpSkin);
      btnMinimize.setStyle("overSkin", btnMinimizeDownSkin);
      btnMinimize.setStyle("downSkin", btnMinimizeDownSkin);
      btnMinimize.addEventListener(MouseEvent.CLICK, minimizeHandler);
      btnMinimize.focusEnabled=false;
      btnMinimize.visible=true;
      rawChildren.addChild(btnMinimize);
      }

      Questions:
      1) For the buttons I add (e.g. btnMinimize) ... if I don't explicitly set the width and height, they default to 0 and button is invisible. Button class says it should size in accordance with the image. Is this normal behavior?
      2) Along the lines of #1 above, if I just create btnMinimize and give it a text label (no image), the button sizes to a width and height of 0. I have to set the width and height for it to appear? Is this normal behavior?
      3) I can't include a screen clip here but the close button succesfully uses the images I provide but it is larger than the other buttons (and the image is distorted). Can I set the height and width of the close button to match the image I'm providing (or conversely can I get the height and width of the close button so I can size my buttons the same)?

      Spent a few days and I'm getting nowhere ...

      thx in advance for any help ...