home *** CD-ROM | disk | FTP | other *** search
/ Practice Anatomy Lab / PAL.ISO / pc / PAL.swf / scripts / __Packages / com / argosy / ui / BreadcrumbMenu.as < prev    next >
Encoding:
Text File  |  2007-03-19  |  3.6 KB  |  115 lines

  1. class com.argosy.ui.BreadcrumbMenu extends com.argosy.ui.baseUI
  2. {
  3.    var menu_tf;
  4.    var menu_items;
  5.    var dispatchEvent;
  6.    var normal_style;
  7.    var bg;
  8.    function BreadcrumbMenu()
  9.    {
  10.       super();
  11.    }
  12.    function clearContent()
  13.    {
  14.       this.menu_tf.htmlText = "";
  15.       this.menu_items = [];
  16.    }
  17.    function setContent(menu_item)
  18.    {
  19.       this.clearContent();
  20.       this.addMenuItem(menu_item);
  21.    }
  22.    function addMenuItem(menu_item)
  23.    {
  24.       var _loc3_ = {mc:menu_item,index:this.menu_items.length};
  25.       this.menu_items.push(_loc3_);
  26.       if(menu_item.type == "menu" && menu_item.parent != undefined)
  27.       {
  28.          this.addMenuItem(menu_item.parent);
  29.       }
  30.       else if(menu_item.type == "activity")
  31.       {
  32.          this.addMenuItem(menu_item._parent);
  33.       }
  34.       this.layout_menu();
  35.    }
  36.    function layout_menu()
  37.    {
  38.       var _loc3_ = "";
  39.       var _loc2_ = 0;
  40.       while(_loc2_ < this.menu_items.length)
  41.       {
  42.          if(_loc2_ > 0)
  43.          {
  44.             _loc3_ = "<a href=\'asfunction:link_press, " + this.menu_items[_loc2_].index + "\'>" + this.toTitleCaps(this.menu_items[_loc2_].mc.title) + "</a>" + " > " + _loc3_;
  45.          }
  46.          else
  47.          {
  48.             _loc3_ = this.toTitleCaps(this.menu_items[_loc2_].mc.title) + _loc3_;
  49.          }
  50.          _loc2_ = _loc2_ + 1;
  51.       }
  52.       _loc3_ = "<p>" + _loc3_ + "</p>";
  53.       this.menu_tf.htmlText = _loc3_;
  54.    }
  55.    function link_press(id)
  56.    {
  57.       var _loc2_ = this.menu_items[Number(id)].mc;
  58.       trace(["link_press",id,_loc2_]);
  59.       this.dispatchEvent({type:"selection",target:_loc2_,type:_loc2_.type});
  60.    }
  61.    function init()
  62.    {
  63.       this.normal_style = new TextField.StyleSheet();
  64.       this.normal_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#1F3A70",textAlign:"left",textDecoration:"none",kerning:"true",letterSpacing:"0"});
  65.       this.normal_style.setStyle("a:link",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#1F3A70"});
  66.       this.normal_style.setStyle("a:hover",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#438CB8"});
  67.       super.init();
  68.    }
  69.    function createChildren()
  70.    {
  71.       this.bg = this.createEmptyMovieClip("bg",1);
  72.       this.menu_tf = this.createTextField("menu_tf",2,25,2,this.width - 50,20);
  73.       this.menu_tf.selectable = false;
  74.       this.menu_tf.html = true;
  75.       this.menu_tf.embedFonts = true;
  76.       this.menu_tf.autoSize = true;
  77.       this.menu_tf.styleSheet = this.normal_style;
  78.    }
  79.    function layout()
  80.    {
  81.       this.bg.clear();
  82.       this.bg.lineStyle(0,16711680,0);
  83.       this.bg.beginFill(16777215,0);
  84.       this.bg.lineTo(this.width,0);
  85.       this.bg.lineTo(this.width,this.height);
  86.       this.bg.lineTo(0,this.height);
  87.       this.bg.lineTo(0,0);
  88.       this.bg.endFill();
  89.       this.menu_tf._width = this.width;
  90.       this.menu_tf._height = this.height;
  91.    }
  92.    function disableHover()
  93.    {
  94.       trace("disable hover");
  95.       this.normal_style.setStyle("a:hover",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#1F3A70"});
  96.       var _loc2_ = 0;
  97.       while(_loc2_ < this.menu_items.length)
  98.       {
  99.          this.menu_items[_loc2_].mc.label_tf.styleSheet = this.normal_style;
  100.          _loc2_ = _loc2_ + 1;
  101.       }
  102.    }
  103.    function enableHover()
  104.    {
  105.       trace("enable hover");
  106.       this.normal_style.setStyle("a:hover",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#438CB8"});
  107.       var _loc2_ = 0;
  108.       while(_loc2_ < this.menu_items.length)
  109.       {
  110.          this.menu_items[_loc2_].mc.label_tf.styleSheet = this.normal_style;
  111.          _loc2_ = _loc2_ + 1;
  112.       }
  113.    }
  114. }
  115.