home *** CD-ROM | disk | FTP | other *** search
- class com.argosy.ui.PopMenu extends com.argosy.ui.baseUI
- {
- var bg;
- var drop_shadow;
- var menu_items;
- var title;
- var active;
- var instructions;
- var top_parent;
- var stage_x;
- var dispatchEvent;
- var selected_mc;
- static var normal_style;
- static var over_style;
- static var selected_style;
- var type = "menu";
- var menu_height = 25;
- function PopMenu()
- {
- super();
- }
- function show(state)
- {
- if(state)
- {
- this.bg.filters = [this.drop_shadow];
- this._visible = true;
- }
- else
- {
- this.bg.filters = [];
- this._visible = false;
- this.setMenuOver(null);
- }
- for(var _loc2_ in this.menu_items)
- {
- if(this.menu_items[_loc2_].type == "menu")
- {
- this.menu_items[_loc2_].pop_menu.show(false);
- }
- }
- }
- function setContent(node)
- {
- this.title = node.attributes.title;
- if(this.active != false)
- {
- this.active = node.attributes.active == undefined || node.attributes.active == "true";
- }
- if(node.attributes.instructions != undefined)
- {
- this.instructions = "<p><font face=\'Frutiger Bold\' size=\'24\' color=\'#" + this.top_parent.color + "\'>" + node.attributes.title + "</font><br/><br/>" + "<font face=\'Frutiger Bold\' size=\'12\' color=\'#000000\'>" + node.attributes.instructions + "</font></p>";
- }
- else
- {
- this.instructions = "<p><font face=\'Frutiger Bold\' size=\'24\' color=\'#" + this.top_parent.color + "\'>" + node.attributes.title + "</font><br/><br/></p>";
- }
- this.menu_items = [];
- var _loc5_ = 0;
- while(_loc5_ < node.childNodes.length)
- {
- if(node.childNodes[_loc5_].nodeName != "activityText")
- {
- var _loc3_ = node.childNodes[_loc5_];
- var _loc8_ = this.getNextHighestDepth();
- var _loc2_ = this.createEmptyMovieClip("menu_" + _loc8_,_loc8_);
- _loc2_.title = _loc3_.attributes.title;
- _loc2_.showActivityText = _loc3_.attributes.activityText == "true";
- _loc2_.label_tf = _loc2_.createTextField("title",10,0,4,this.width,12);
- _loc2_.label_tf.selectable = false;
- _loc2_.label_tf.html = true;
- _loc2_.label_tf.embedFonts = true;
- _loc2_.label_tf.styleSheet = com.argosy.ui.PopMenu.normal_style;
- _loc2_.label_tf.htmlText = "<p>" + _loc2_.title + "</p>";
- if(this.active == false || _loc3_.attributes.active == "false")
- {
- _loc2_.active = false;
- _loc2_.label_tf._alpha = 50;
- }
- _loc2_.bg = _loc2_.createEmptyMovieClip("bg",1);
- _loc2_.bg.lineStyle(0,0,0);
- _loc2_.bg.beginFill(0,0);
- _loc2_.bg.moveTo(1,0);
- _loc2_.bg.lineTo(this.width,0);
- _loc2_.bg.lineTo(this.width,this.menu_height);
- _loc2_.bg.lineTo(1,this.menu_height);
- _loc2_.bg.lineTo(1,0);
- _loc2_.bg.endFill();
- if(_loc5_ < node.childNodes.length - 1)
- {
- var _loc7_ = new flash.geom.Matrix();
- _loc7_.createGradientBox(this.width,20,0,0,0);
- _loc2_.bg.beginGradientFill("linear",[6710886,6710886,6710886],[0,100,0],[0,128,255],_loc7_,"pad");
- _loc2_.bg.moveTo(20,this.menu_height);
- _loc2_.bg.lineTo(this.width - 20,this.menu_height);
- _loc2_.bg.lineTo(this.width - 20,this.menu_height + 1);
- _loc2_.bg.lineTo(20,this.menu_height + 1);
- _loc2_.bg.lineTo(20,this.menu_height);
- _loc2_.bg.endFill();
- }
- _loc2_.hl = _loc2_.createEmptyMovieClip("hl",2);
- _loc2_.hl.lineStyle(0,0,0);
- _loc7_ = new flash.geom.Matrix();
- _loc7_.createGradientBox(this.width,this.menu_height,1.5707963267948966,0,0);
- var _loc4_ = "0x" + this.top_parent.color;
- _loc2_.hl.beginGradientFill("linear",[_loc4_,_loc4_,_loc4_,_loc4_],[10,100,100,10],[0,64,192,255],_loc7_,"pad");
- _loc2_.hl.moveTo(1,0);
- _loc2_.hl.lineTo(this.width,0);
- _loc2_.hl.lineTo(this.width,this.menu_height);
- _loc2_.hl.lineTo(1,this.menu_height);
- _loc2_.hl.lineTo(1,0);
- _loc2_.hl.endFill();
- _loc2_.hl._visible = false;
- _loc2_.bg.onRollOver = ascb.util.Proxy.create(this,this.menuOver,_loc2_);
- _loc2_.bg.onRollOut = ascb.util.Proxy.create(this,this.menuOut,_loc2_);
- _loc2_.bg.onPress = ascb.util.Proxy.create(this,this.menuPress,_loc2_);
- _loc2_.bg.onRelease = _loc2_.bg.onReleaseOutside = ascb.util.Proxy.create(this,this.menuRelease,_loc2_);
- if(_loc3_.nodeName == "activity")
- {
- _loc2_.type = "activity";
- _loc2_.parent = this;
- _loc2_.activity_type = _loc3_.attributes.type;
- _loc2_.activity_url = _loc3_.attributes.url;
- _loc2_.top_parent = this.top_parent;
- if(!this.active)
- {
- _loc2_.bg.enabled = false;
- _loc2_._alpha = 50;
- }
- }
- else
- {
- _loc2_.type = "menu";
- _loc2_.pop_menu = _loc2_.attachMovie("PopMenu","pop_menu",100);
- _loc2_.pop_menu.parent = this;
- _loc2_.pop_menu.stage_x = this.stage_x;
- _loc2_.pop_menu.addEventListener("selection",this,"bubbleEvent");
- _loc2_.pop_menu.width = this.width;
- _loc2_.top_parent = this.top_parent;
- _loc2_.pop_menu.top_parent = this.top_parent;
- if(this.active == false)
- {
- _loc2_.pop_menu.active = false;
- }
- if(this.stage_x + this.width * 2 >= Stage.width)
- {
- _loc2_.pop_menu._x = - this.width;
- _loc2_.pop_menu.stage_x = this.stage_x - this.width;
- }
- else
- {
- _loc2_.pop_menu._x = this.width;
- _loc2_.pop_menu.stage_x = this.stage_x + this.width;
- }
- _loc2_.pop_menu.setContent(_loc3_);
- }
- this.menu_items.push(_loc2_);
- }
- _loc5_ = _loc5_ + 1;
- }
- _loc5_ = 0;
- while(_loc5_ < this.menu_items.length)
- {
- this.menu_items[_loc5_]._y = _loc5_ * this.menu_height;
- _loc5_ = _loc5_ + 1;
- }
- this.height = this.menu_items[this.menu_items.length - 1]._y + this.menu_height;
- }
- function bubbleEvent(evt)
- {
- evt.lastOwner = this;
- this.dispatchEvent(evt);
- }
- function getHitTest()
- {
- return this.hitTest(this._xmouse,this._ymouse);
- }
- function setMenuOver(mc)
- {
- for(var _loc3_ in this.menu_items)
- {
- this.menu_items[_loc3_].label_tf.styleSheet = com.argosy.ui.PopMenu.normal_style;
- this.menu_items[_loc3_].label_tf.htmlText = "<p>" + this.menu_items[_loc3_].title + "</p>";
- this.menu_items[_loc3_].hl._visible = false;
- this.menu_items[_loc3_].pop_menu.show(false);
- }
- mc.label_tf.styleSheet = com.argosy.ui.PopMenu.over_style;
- mc.label_tf.htmlText = "<p>" + mc.title + "</p>";
- mc.hl._visible = true;
- mc.pop_menu.show(true);
- this.selected_mc = mc;
- }
- function menuOver(mc)
- {
- this.setMenuOver(mc);
- }
- function menuOut(mc)
- {
- }
- function menuPress(mc)
- {
- }
- function menuRelease(mc)
- {
- this.dispatchEvent({type:"selection",target:mc,button_type:mc.type,lastOwner:this});
- }
- function init()
- {
- super.init();
- if(com.argosy.ui.PopMenu.normal_style == undefined)
- {
- com.argosy.ui.PopMenu.normal_style = new TextField.StyleSheet();
- com.argosy.ui.PopMenu.normal_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#000000",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- com.argosy.ui.PopMenu.over_style = new TextField.StyleSheet();
- com.argosy.ui.PopMenu.over_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#FFFFFF",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- com.argosy.ui.PopMenu.selected_style = new TextField.StyleSheet();
- com.argosy.ui.PopMenu.selected_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#FFFFFF",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- }
- this.show(false);
- }
- function createChildren()
- {
- this.bg = this.createEmptyMovieClip("bg",1);
- this.drop_shadow = new flash.filters.DropShadowFilter(5,45,0,0.8,10,10,1,3);
- }
- function layout()
- {
- this.bg.clear();
- this.bg.lineStyle(0,13421772,100);
- this.bg.beginFill(16777215,100);
- this.bg.lineTo(this.width,0);
- this.bg.lineTo(this.width,this.height);
- this.bg.lineTo(0,this.height);
- this.bg.lineTo(0,0);
- this.bg.endFill();
- }
- }
-