home *** CD-ROM | disk | FTP | other *** search
- class com.argosy.ui.LabelHotSpot
- {
- var leader_mc;
- var white_leader;
- var label_hl;
- var pinFilter;
- var color;
- var glowFilter;
- var hideFilter;
- var leaderFilter;
- var label_mc;
- var snap_point;
- var label_tf;
- var dynamicLeader;
- var label;
- var type;
- var pin_mc;
- var dispatchEvent;
- var id;
- static var label_style;
- static var hl_style;
- static var color_array = [16777215,2479612,41210,10257403,14922492,64253,10288382];
- var showAllOutlines = false;
- var showAllLabels = false;
- var showRollOvers = true;
- function LabelHotSpot()
- {
- com.gskinner.events.GDispatcher.initialize(this);
- if(com.argosy.ui.LabelHotSpot.label_style == undefined)
- {
- com.argosy.ui.LabelHotSpot.label_style = new TextField.StyleSheet();
- com.argosy.ui.LabelHotSpot.label_style.setStyle("p",{fontFamily:"Univers Bold",fontSize:"13",color:"#000000",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- com.argosy.ui.LabelHotSpot.label_style.setStyle("pin",{fontFamily:"Univers Bold",fontSize:"13",color:"#FFFFFF",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- com.argosy.ui.LabelHotSpot.hl_style = new TextField.StyleSheet();
- com.argosy.ui.LabelHotSpot.hl_style.setStyle("p",{fontFamily:"Univers Bold",fontSize:"13",color:"#005B93",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- }
- }
- function set showLabels(b)
- {
- this.showAllLabels = b;
- this.leader_mc._visible = this.showAllLabels;
- this.white_leader._visible = this.showAllLabels;
- this.label_hl._visible = this.showAllLabels;
- }
- function get showLabels()
- {
- return this.showAllLabels;
- }
- function set graphic(graphic_mc)
- {
- this.pinFilter = new flash.filters.DropShadowFilter(0,45,0,0.8,5,5,2,3,false,false,false);
- if(this.color == 0)
- {
- this.glowFilter = new flash.filters.GlowFilter(com.argosy.ui.LabelHotSpot.color_array[this.color],0,2,2,10,4,true,true);
- }
- else
- {
- this.glowFilter = new flash.filters.GlowFilter(com.argosy.ui.LabelHotSpot.color_array[this.color],0.8,2,2,10,4,true,true);
- }
- this.hideFilter = new flash.filters.GlowFilter(0,0,0,0,1,1,true,true);
- this.leaderFilter = new flash.filters.GlowFilter(16777215,0.8,2,2,10,3);
- this.label_mc = graphic_mc;
- this.label_mc.myObject = this;
- this.snap_point = this.label_mc.snap_point;
- this.snap_point._visible = false;
- this.label_tf = this.label_mc.label_tf;
- this.label_tf._visible = false;
- if(this.label_mc.leader_mc == undefined)
- {
- this.leader_mc = this.label_mc.createEmptyMovieClip("leader_mc",this.label_mc.getNextHighestDepth());
- this.dynamicLeader = true;
- }
- else
- {
- this.leader_mc = this.label_mc.leader_mc;
- this.dynamicLeader = false;
- }
- if(this.leader_mc.white_leader == undefined)
- {
- this.white_leader = this.leader_mc.createEmptyMovieClip("white_leader",this.leader_mc.getNextHighestDepth());
- }
- else
- {
- this.white_leader = this.leader_mc.white_leader;
- }
- this.leader_mc.filters = [this.leaderFilter];
- this.label_hl = this.label_mc.createEmptyMovieClip("label_hl",this.label_mc.getNextHighestDepth());
- this.label_hl.tf = this.label_hl.createTextField("tf",1,0,0,this.label_mc.label_tf._width,this.label_mc.label_tf._height);
- this.label_hl._x = this.label_mc.label_tf._x;
- this.label_hl._y = this.label_mc.label_tf._y;
- this.label_hl.tf.multiline = true;
- this.label_hl.tf.autoSize = true;
- this.label_hl.tf.background = false;
- this.label_hl.tf.border = false;
- this.label_hl.tf.html = true;
- this.label_hl.tf.embedFonts = true;
- this.label_hl.tf.selectable = true;
- this.label_hl.tf.styleSheet = com.argosy.ui.LabelHotSpot.label_style;
- this.label_hl.tf.htmlText = "<p>" + this.label + "</p>";
- this.label_hl.filters = [this.leaderFilter];
- if(this.type == "pin")
- {
- var _loc6_ = 30;
- this.pin_mc = this.label_mc.createEmptyMovieClip("pin_mc",this.label_mc.getNextHighestDepth());
- this.pin_mc._x = this.snap_point._x;
- this.pin_mc._y = this.snap_point._y - _loc6_;
- this.pin_mc.beginFill(6710886,100);
- this.pin_mc.lineStyle(2,3355443,100,false,"none","square","miter",4);
- this.pin_mc.moveTo(2,0);
- this.pin_mc.lineTo(0,_loc6_);
- this.pin_mc.lineStyle(2,13421772,100,false,"none","square","miter",4);
- this.pin_mc.lineTo(-2,0);
- this.pin_mc.lineStyle(1,13421772,100,false,"none","square","miter",4);
- this.pin_mc.lineTo(2,0);
- this.pin_mc.endFill();
- this.pin_mc.lineStyle(1,0,100);
- this.pin_mc.beginFill(2039399,100);
- com.drawing.drawUtil.drawOval(this.pin_mc,0,0,8,8);
- this.pin_mc.endFill();
- if(this.label.length == 1)
- {
- this.pin_mc.tf = this.pin_mc.createTextField("tf",1,-5,-5,10,10);
- this.pin_mc.tf.autoSize = true;
- this.pin_mc.tf.html = true;
- this.pin_mc.tf.embedFonts = true;
- this.pin_mc.tf.selectable = false;
- this.pin_mc.tf.styleSheet = com.argosy.ui.LabelHotSpot.label_style;
- this.pin_mc.tf.htmlText = "<p><pin>" + this.label + "</pin></p>";
- this.pin_mc.tf._x = - this.pin_mc.tf._width / 2;
- this.pin_mc.tf._y = - this.pin_mc.tf._height / 2;
- }
- this.pin_mc._visible = this.showAllOutlines;
- var _loc9_ = new flash.filters.GlowFilter(com.argosy.ui.LabelHotSpot.color_array[this.color],0.8,5,5,2,4,false,false);
- this.pin_mc.filters = [_loc9_];
- }
- if(this.dynamicLeader)
- {
- var _loc3_ = 0;
- var _loc5_ = this.label_hl._x + this.label_hl._width / 2;
- var _loc4_ = this.label_hl._y + this.label_hl._height / 2;
- var _loc8_ = _loc5_ + _loc3_ * (this.snap_point._x - _loc5_);
- var _loc7_ = _loc4_ + _loc3_ * (this.snap_point._y - _loc4_);
- this.leader_mc.lineStyle(2,0,50);
- this.leader_mc.moveTo(_loc8_,_loc7_);
- this.leader_mc.lineTo(this.snap_point._x,this.snap_point._y);
- }
- var _loc2_ = new Object();
- _loc2_.x = this.label_hl._x;
- _loc2_.y = this.label_hl._y;
- this.label_mc.localToGlobal(_loc2_);
- this.white_leader.globalToLocal(_loc2_);
- _loc2_.x += 3;
- _loc2_.y += 3;
- this.white_leader.moveTo(_loc2_.x,_loc2_.y);
- this.white_leader.beginFill(16711680,100);
- this.white_leader.lineTo(_loc2_.x + this.label_hl._width - 6,_loc2_.y);
- this.white_leader.lineTo(_loc2_.x + this.label_hl._width - 6,_loc2_.y + this.label_hl._height - 6);
- this.white_leader.lineTo(_loc2_.x,_loc2_.y + this.label_hl._height - 6);
- this.white_leader.lineTo(_loc2_.x,_loc2_.y);
- this.white_leader.endFill();
- this.leader_mc.blendMode = "layer";
- this.white_leader.blendMode = "erase";
- if(this.showAllOutlines)
- {
- if(this.type == "pin")
- {
- this.pin_mc._visible = true;
- this.label_mc.hotspot.filters = [this.hideFilter];
- }
- else
- {
- this.label_mc.hotspot.filters = [this.glowFilter];
- }
- }
- else
- {
- this.label_mc.hotspot.filters = [this.hideFilter];
- }
- if(!this.showAllLabels || this.label == undefined || this.type == "pin")
- {
- this.label_hl._visible = false;
- this.leader_mc._visible = false;
- this.white_leader._visible = false;
- }
- if(this.showRollOvers)
- {
- this.label_mc.onRollOver = this.label_mc.onDragOver = ascb.util.Proxy.create(this,this._rollOver);
- this.label_mc.onRollOut = this.label_mc.onDragOut = ascb.util.Proxy.create(this,this._rollOut);
- this.label_mc.onPress = ascb.util.Proxy.create(this,this._press);
- this.label_mc.onRelease = ascb.util.Proxy.create(this,this._release);
- }
- }
- function get graphic()
- {
- return this.label_mc;
- }
- function showHitTestOutline(mc)
- {
- if(mc != null && this.label_mc.hotspot.hitTest(_xmouse,_ymouse,true))
- {
- this.label_mc.hotspot.filters = [this.glowFilter];
- return this.label_mc;
- }
- this.label_mc.hotspot.filters = [this.hideFilter];
- return null;
- }
- function _rollOver()
- {
- if(this.type == "pin")
- {
- this.pin_mc.gotoAndStop(15);
- this.pin_mc._visible = true;
- }
- else
- {
- this.label_mc.hotspot.filters = [this.glowFilter];
- }
- this.label_hl.tf.styleSheet = com.argosy.ui.LabelHotSpot.hl_style;
- this.label_hl.tf.htmlText = "<p>" + this.label + "</p>";
- this.leader_mc._visible = true;
- this.white_leader._visible = true;
- this.label_hl._visible = true;
- }
- function _rollOut()
- {
- if(!this.showAllOutlines)
- {
- if(this.type == "pin")
- {
- this.pin_mc._visible = false;
- }
- else
- {
- this.label_mc.hotspot.filters = [this.hideFilter];
- }
- }
- this.label_hl.tf.styleSheet = com.argosy.ui.LabelHotSpot.label_style;
- this.label_hl.tf.htmlText = "<p>" + this.label + "</p>";
- if(!this.showAllLabels)
- {
- this.leader_mc._visible = false;
- this.white_leader._visible = false;
- this.label_hl._visible = false;
- }
- }
- function _press()
- {
- this.dispatchEvent({type:"press",target:this,id:this.id});
- }
- function _release()
- {
- this.dispatchEvent({type:"release",target:this,id:this.id});
- }
- }
-