ndt-dev - [ndt-dev] [ndt] r906 committed - Active button is now highlighted on results view in flash client
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r906 committed - Active button is now highlighted on results view in flash client
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r906 committed - Active button is now highlighted on results view in flash client
- Date: Wed, 12 Feb 2014 13:15:16 +0000
Revision: 906
Author:
Date: Wed Feb 12 13:14:56 2014 UTC
Log: Active button is now highlighted on results view in flash client
http://code.google.com/p/ndt/source/detail?r=906
Modified:
/branches/FlashIssue118/flash-client/src/GUI.as
=======================================
--- /branches/FlashIssue118/flash-client/src/GUI.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/FlashIssue118/flash-client/src/GUI.as Wed Feb 12 13:14:56 2014 UTC
@@ -48,10 +48,11 @@
private var _consoleText:TextField;
private var _resultsTextField:TextField;
private var _summaryResultText:String;
- private var _resultsButton:Sprite;
- private var _detailsButton:Sprite;
- private var _errorsButton:Sprite;
- private var _debugButton:Sprite;
+ private var _resultsButton:NDTButton;
+ private var _detailsButton:NDTButton;
+ private var _errorsButton:NDTButton;
+ private var _debugButton:NDTButton;
+ private var _activeButton:NDTButton;
public function GUI(
stageWidth:int, stageHeight:int, callerObj:NDTPController) {
@@ -248,6 +249,7 @@
if (_debugButton)
_debugButton.addEventListener(MouseEvent.CLICK, clickDebug);
+ changeActiveButton(_resultsButton);
setSummaryResultText();
_resultsTextField.htmlText = _summaryResultText;
}
@@ -313,27 +315,38 @@
}
private function clickResults(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = _summaryResultText;
_resultsTextField.scrollV = 0;
- }
+ }
private function clickDetails(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getResultDetails();
_resultsTextField.scrollV = 0;
}
private function clickDebug(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getDebugMsg();
_resultsTextField.scrollV = 0;
}
private function clickErrors(e:MouseEvent):void {
+ changeActiveButton(NDTButton(e.target));
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getErrMsg();
_resultsTextField.scrollV = 0;
}
+
+ private function changeActiveButton(target:NDTButton):void {
+ if (_activeButton)
+ _activeButton.setInactive();
+ target.setActive();
+ _activeButton = target;
+ }
}
}
@@ -344,6 +357,8 @@
class NDTButton extends Sprite {
[Embed(source="../assets/hover.png")]
private var ButtonImg:Class;
+
+ private var _textField:TextField;
function NDTButton(text:String, textSize:int, height:int, prop:Number) {
super();
@@ -355,9 +370,9 @@
textFormat.bold = true;
textFormat.align = TextFormatAlign.CENTER;
textFormat.color = 0xFFFFFF;
- var textField:TextField = new TextField();
- textField.defaultTextFormat = textFormat;
- textField.text = text;
+ _textField = new TextField();
+ _textField.defaultTextFormat = textFormat;
+ _textField.text = text;
var buttonShape:DisplayObject = new ButtonImg();
@@ -365,15 +380,27 @@
buttonShape.height *= prop;
buttonShape.x -= buttonShape.width / 2;
buttonShape.y -= buttonShape.height / 2;
- textField.width = buttonShape.width;
- textField.height = height;
- textField.x -= textField.width / 2;
- textField.y -= textField.height / 2;
+ _textField.width = buttonShape.width;
+ _textField.height = height;
+ _textField.x -= _textField.width / 2;
+ _textField.y -= _textField.height / 2;
this.addChild(buttonShape);
- this.addChild(textField);
+ this.addChild(_textField);
this.mouseChildren = false;
}
+
+ public function setActive():void {
+ var textFormat:TextFormat = _textField.getTextFormat();
+ textFormat.color = 0xFFFF00;
+ _textField.setTextFormat(textFormat);
+ }
+
+ public function setInactive():void {
+ var textFormat:TextFormat = _textField.getTextFormat();
+ textFormat.color = 0xFFFFFF;
+ _textField.setTextFormat(textFormat);
+ }
}
class ResultsTextField extends TextField {
- [ndt-dev] [ndt] r906 committed - Active button is now highlighted on results view in flash client, ndt, 02/12/2014
Archive powered by MHonArc 2.6.16.