[moodle] / contrib / plugins / grade / report / visual / flare_visualization / Button.as Repository:

Diff of /contrib/plugins/grade/report/visual/flare_visualization/Button.as

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Tue Jul 1 15:30:01 2008 WST revision 1.2, Tue Jul 15 03:27:17 2008 WST

By dservos:

CONTRIB-497 Cleaned up some of the code for report/visual and the flex based application for viewing the visualizations. Improved the UI of the visualization. Added documentation to both the php and actionscript 3 (flex) code. Removed some unneeded files. TODO: *Add more visualizations. *Add printer firendly version. *Make flex appplications settings less hardcoded and loaded from moodle. *Load lang files from moodle to flex for full language support. *Add a settings page for the report.

# Line 1  Line 1 
1    ///////////////////////////////////////////////////////////////////////////
2    //                                                                       //
3    // NOTICE OF COPYRIGHT                                                   //
4    //                                                                       //
5    // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
6    //          http://moodle.org                                            //
7    //                                                                       //
8    // Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
9    //                                                                       //
10    // This program is free software; you can redistribute it and/or modify  //
11    // it under the terms of the GNU General Public License as published by  //
12    // the Free Software Foundation; either version 2 of the License, or     //
13    // (at your option) any later version.                                   //
14    //                                                                       //
15    // This program is distributed in the hope that it will be useful,       //
16    // but WITHOUT ANY WARRANTY; without even the implied warranty of        //
17    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
18    // GNU General Public License for more details:                          //
19    //                                                                       //
20    //          http://www.gnu.org/copyleft/gpl.html                         //
21    //                                                                       //
22    ///////////////////////////////////////////////////////////////////////////
23    
24  package {  package {
25          import flash.display.SimpleButton;          import flash.display.SimpleButton;
26          import flash.text.TextField;          import flash.text.TextField;
# Line 8  Line 31 
31          private var overColor:uint = 0xBABAFF;          private var overColor:uint = 0xBABAFF;
32          private var downColor:uint = 0xBBBBFF;          private var downColor:uint = 0xBBBBFF;
33          private var fmt:TextFormat = new TextFormat("mono",12,0,null,null,null,null,null,"center");          private var fmt:TextFormat = new TextFormat("mono",12,0,null,null,null,null,null,"center");
34            private var buttonText:String;
35    
36          public var props:Object = new Object();          public var props:Object = new Object();
37    
38                  public function Button(text:String) {                  public function Button(text:String) {
39                            buttonText = text;
40                          downState = new ButtonDisplayState(text, fmt, downColor);                          downState = new ButtonDisplayState(text, fmt, downColor);
41                  overState = new ButtonDisplayState(text, fmt, overColor);                  overState = new ButtonDisplayState(text, fmt, overColor);
42                  upState = new ButtonDisplayState(text, fmt, upColor);                  upState = new ButtonDisplayState(text, fmt, upColor);
43                  hitTestState = upState;                  hitTestState = upState;
44                  useHandCursor = true;                  useHandCursor = true;
45                  }                  }
46    
47                    public function set text(text:String):void {
48                            buttonText = text;
49                            ButtonDisplayState(downState).text = text;
50                            ButtonDisplayState(overState).text = text;
51                            ButtonDisplayState(upState).text = text;
52                    }
53    
54                    public function get text():String {
55                            return buttonText;
56                    }
57          }          }
58  }  }
59    
# Line 32  Line 68 
68      private var bgColor:uint;      private var bgColor:uint;
69      private var w:uint;      private var w:uint;
70      private var h:uint;      private var h:uint;
71            private var buttonText:String;
72            private var fmt:TextFormat;
73            private var ts:TextSprite;
74    
75          public function ButtonDisplayState(text:String, fmt:TextFormat, bgColor:uint) {          public function ButtonDisplayState(text:String, fmt:TextFormat, bgColor:uint) {
76                  this.bgColor = bgColor;                  this.bgColor = bgColor;
77                    buttonText = text;
78                    this.fmt = fmt;
79                    this.ts = new TextSprite(text, fmt);
80    
                 var ts:TextSprite = new TextSprite(text, fmt);  
81                  var tf:TextField = ts.textField;                  var tf:TextField = ts.textField;
82    
83          w = tf.width = tf.textWidth + 6;          w = tf.width = tf.textWidth + 6;
# Line 53  Line 94 
94          graphics.drawRoundRect(0, 0, w, h, 10, 10);          graphics.drawRoundRect(0, 0, w, h, 10, 10);
95          graphics.endFill();          graphics.endFill();
96          }          }
97    
98            public function set text(text:String):void {
99                    buttonText = text;
100                    ts.text = text;
101            }
102  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7