import mx.transitions.Tween; import mx.transitions.easing.*; class BarStyle extends Style { public var is_bar:Boolean = true; // MovieClip that holds each bar: private var bar_mcs:Array; public var name:String; public function BarStyle( lv:Object, name:String ) { this.name = 'bar'+name; // this calls parent obj Style.Style first this.parse_bar( lv[this.name] ); this.set_values( lv['values'+name], lv['links'+name], lv['tool_tips_set'+name] ); } public function parse_bar( val:String ) { var vals:Array = val.split(","); this.alpha = Number( vals[0] ); this.colour = _root.get_colour(vals[1]); if( vals.length > 2 ) this.key = vals[2].replace('#comma#',','); if( vals.length > 3 ) this.font_size = Number( vals[3] ); } // override Style:set_values function set_values( vals:String, links:String, tooltips:String ) { super.set_values( this.parse_list( vals ) ); this.set_links( links ); this.set_tooltips( tooltips ); this.set_mcs(this.values.length); } private function set_mcs( count:Number ) { // delete the old movie clips // this should be in the deconstructor... if( this.bar_mcs!=undefined ) { for( var i:Number=0; i this.ExPoints[i].x) && (x < this.ExPoints[i].x+this.ExPoints[i].width) ) { // mouse is in position 1 shortest = Math.min( Math.abs( x - this.ExPoints[i].x ), Math.abs( x - (this.ExPoints[i].x+this.ExPoints[i].width) ) ); ex = this.ExPoints[i]; break; } else { // mouse is in position 2 // get distance to left side and right side var d1:Number = Math.abs( x - this.ExPoints[i].x ); var d2:Number = Math.abs( x - (this.ExPoints[i].x+this.ExPoints[i].width) ); var min:Number = Math.min( d1, d2 ); if( min < shortest ) { shortest = min; ex = this.ExPoints[i]; } } } var dy:Number = Math.abs( y - ex.y ); return { point:ex, distance_x:shortest, distance_y:dy }; } }