diff options
Diffstat (limited to 'libs/open-flash-chart/actionscript/XLegend.as')
-rw-r--r-- | libs/open-flash-chart/actionscript/XLegend.as | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libs/open-flash-chart/actionscript/XLegend.as b/libs/open-flash-chart/actionscript/XLegend.as new file mode 100644 index 0000000000..a55af62b52 --- /dev/null +++ b/libs/open-flash-chart/actionscript/XLegend.as @@ -0,0 +1,72 @@ +class XLegend extends Title
+{
+
+ // override the MovieClip name:
+ private var name:String = 'x_legend';
+ public var mc:TextField;
+
+ function XLegend( lv:LoadVars )
+ {
+ if( lv.x_legend == undefined )
+ return;
+
+ var tmp:Array = lv.x_legend.split(',');
+
+ var text:String = tmp[0];
+ this.size = Number( tmp[1] );
+ this.colour = _root.get_colour( tmp[2] );
+
+ // call our parent (Title) constructor:
+ // super.build( text );
+
+ // while no CSS :
+ this.build( text );
+ }
+
+ // remove when this gets CSS
+ function build( text:String )
+ {
+ this.title = text;
+
+ if( this.mc == undefined )
+ this.mc = _root.createTextField( 'title', _root.getNextHighestDepth(), 0, 0, 200, 200 );
+
+ this.mc.text = this.title;
+
+ var fmt:TextFormat = new TextFormat();
+ fmt.color = this.colour;
+ fmt.font = "Verdana";
+ fmt.size = this.size;
+
+ fmt.align = "center";
+
+ this.mc.setTextFormat(fmt);
+ this.mc.autoSize = "left";
+ }
+
+ function get_legend()
+ {
+ return this.title;
+ }
+
+ function move()
+ {
+ // this will center it in the X
+ super.move();
+ // this will align bottom:
+ this.mc._y = Stage.height - this.mc._height;
+ }
+
+ //
+ // this is only here while title has CSS and x legend does not.
+ // remove this when we put css in this object
+ //
+ function height()
+ {
+ // the title may be turned off:
+ if( this.mc == undefined )
+ return 0;
+ else
+ return this.mc._height;
+ }
+}
\ No newline at end of file |