home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / sky-chopper.swf / scripts / __Packages / mx / controls / menuclasses / MenuBarItem.as next >
Encoding:
Text File  |  2005-09-29  |  2.0 KB  |  77 lines

  1. class mx.controls.menuclasses.MenuBarItem extends mx.core.UIComponent
  2. {
  3.    var __initText;
  4.    var cell;
  5.    var owner;
  6.    var __width;
  7.    var __height;
  8.    var border_mc;
  9.    var menuBarIndex;
  10.    var __cellHeightBuffer = 3;
  11.    var __cellWidthBuffer = 20;
  12.    var __isDown = false;
  13.    var __isClosing = false;
  14.    function MenuBarItem()
  15.    {
  16.       super();
  17.    }
  18.    function createChildren(Void)
  19.    {
  20.       super.createChildren();
  21.       this.createLabel("cell",20);
  22.       this.cell.setValue(this.__initText);
  23.       this.createClassObject(mx.skins.halo.ActivatorSkin,"border_mc",0,{styleName:this.owner,borderStyle:"none"});
  24.       this.useHandCursor = false;
  25.       this.trackAsMenu = true;
  26.    }
  27.    function size(Void)
  28.    {
  29.       super.size();
  30.       this.border_mc.setSize(this.__width,this.__height);
  31.       this.cell.setSize(this.__width - this.__cellWidthBuffer,this.cell.getPreferredHeight());
  32.       this.cell._x = this.__cellWidthBuffer / 2;
  33.       this.cell._y = (this.__height - this.cell._height) / 2;
  34.    }
  35.    function getPreferredWidth(Void)
  36.    {
  37.       return this.cell.getPreferredWidth() + this.__cellWidthBuffer;
  38.    }
  39.    function setLabelBorder(style)
  40.    {
  41.       this.border_mc.borderStyle = style;
  42.       this.border_mc.draw();
  43.    }
  44.    function setEnabled(state)
  45.    {
  46.       this.enabled = this.cell.enabled = state;
  47.       if(!this.enabled)
  48.       {
  49.          this.setLabelBorder("none");
  50.       }
  51.    }
  52.    function onPress(Void)
  53.    {
  54.       this.owner.onItemPress(this.menuBarIndex);
  55.    }
  56.    function onRelease(Void)
  57.    {
  58.       this.owner.onItemRelease(this.menuBarIndex);
  59.    }
  60.    function onRollOver(Void)
  61.    {
  62.       this.owner.onItemRollOver(this.menuBarIndex);
  63.    }
  64.    function onRollOut(Void)
  65.    {
  66.       this.owner.onItemRollOut(this.menuBarIndex);
  67.    }
  68.    function onDragOver(Void)
  69.    {
  70.       this.owner.onItemDragOver(this.menuBarIndex);
  71.    }
  72.    function onDragOut(Void)
  73.    {
  74.       this.owner.onItemDragOut(this.menuBarIndex);
  75.    }
  76. }
  77.