home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / hungerstrike.swf / scripts / __Packages / npb_contextmenu.as
Encoding:
Text File  |  2007-09-28  |  1.7 KB  |  57 lines

  1. class npb_contextmenu extends MovieClip
  2. {
  3.    var tf;
  4.    var labels = new Array();
  5.    var links = new Array();
  6.    var seperators = new Array();
  7.    var showBuiltIns = new Boolean();
  8.    var autoHide = new Boolean();
  9.    function npb_contextmenu()
  10.    {
  11.       super();
  12.       if(this.autoHide)
  13.       {
  14.          this._visible = false;
  15.       }
  16.       var _loc6_ = new ContextMenu();
  17.       if(!this.showBuiltIns)
  18.       {
  19.          _loc6_.hideBuiltInItems();
  20.       }
  21.       var _loc4_ = 0;
  22.       while(_loc4_ < this.labels.length)
  23.       {
  24.          var _loc5_ = new ContextMenuItem(this.labels[_loc4_],null);
  25.          _loc5_.onSelect = function(m, obj)
  26.          {
  27.             npb_contextmenu.openWindow(obj.i);
  28.          };
  29.          _loc5_.i = this.links[_loc4_];
  30.          _loc6_.customItems.push(_loc5_);
  31.          _loc4_ = _loc4_ + 1;
  32.       }
  33.       _loc4_ = 0;
  34.       while(_loc4_ < this.seperators.length)
  35.       {
  36.          _loc6_.customItems[this.seperators[_loc4_]].separatorBefore = true;
  37.          _loc4_ = _loc4_ + 1;
  38.       }
  39.       _root.menu = _loc6_;
  40.    }
  41.    static function openWindow(url)
  42.    {
  43.       getURL(url,"_blank");
  44.    }
  45.    function onPress()
  46.    {
  47.       if(this.tf.text == "")
  48.       {
  49.          this.tf.text = "Labels: Labels of the items in the content menu\n\nLinks: URL which the corresponding label goes to when clicked\n\nSeperators: You can specify a list of optional numbers to display seperators before labels. For example 1 will place a seperator before the second label and after the first.\n\nShowBuildIns: Hide or show built in menu items\nautoHide: Hide the component at runtime";
  50.       }
  51.       else
  52.       {
  53.          this.tf.text = "";
  54.       }
  55.    }
  56. }
  57.