flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [8/9] git commit: [flex-asjs] [refs/heads/develop] - fix createjs checkbox, now working properly
Date Thu, 02 May 2013 23:56:11 GMT
fix createjs checkbox, now working properly


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a528433f
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a528433f
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a528433f

Branch: refs/heads/develop
Commit: a528433fac7328f1559ca9bb2ce6a22d20e40524
Parents: 44e73e5
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Fri May 3 01:54:53 2013 +0200
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Fri May 3 01:54:53 2013 +0200

----------------------------------------------------------------------
 .../flex/createjs/staticControls/CheckBox.js       |   20 ++++++++++++--
 1 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a528433f/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
b/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
index f460541..5a2ae5c 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
@@ -30,7 +30,6 @@ goog.inherits(
 org.apache.flex.createjs.staticControls.CheckBox.prototype.checkMark = null;
 org.apache.flex.createjs.staticControls.CheckBox.prototype.checkMarkBackground = null;
 org.apache.flex.createjs.staticControls.CheckBox.prototype.checkBoxLabel = null;
-org.apache.flex.createjs.staticControls.CheckBox.prototype.selected = false;
 
 /**
  * @override
@@ -42,7 +41,11 @@ org.apache.flex.createjs.staticControls.CheckBox.prototype.addToParent
= functio
 	this.checkMarkBackground = new createjs.Shape();
 	this.checkMarkBackground.name = "checkmarkbackground";
 	this.checkMarkBackground.graphics.beginFill("red").drawRoundRect(0, 0, 40, 40, 8);
-	
+	//this.checkMarkBackground.graphics.setStrokeStyle( 0 ).beginStroke( '#000' ).drawRect(
0, 0, this.width, this.height);
+	//var hit = new createjs.Shape();
+	//hit.graphics.beginFill("#000").drawRect(0, 0, this.width, this.height);
+	//this.checkMarkBackground.hitArea = hit;
+
 	this.checkMark = new createjs.Shape();
 	this.checkMark.name = "checkmark";
 	this.checkMark.graphics.beginFill("white").drawRoundRect(0, 0, 32, 32, 6);
@@ -56,10 +59,13 @@ org.apache.flex.createjs.staticControls.CheckBox.prototype.addToParent
= functio
 	this.checkBoxLabel.textBaseline = "middle";
 	this.checkBoxLabel.x = 45;
 	this.checkBoxLabel.y = 40/2;
-	
+
 	this.element = new createjs.Container();
 	this.element.name = "checkbox";
 	this.element.addChild(this.checkMarkBackground, this.checkBoxLabel, this.checkMark);
+	// use bind(this) to avoid loose scope
+	this.element.onClick = this.clickHandler.bind(this);
+
 	p.addChild(this.element);
 
     this.positioner = this.element;
@@ -101,3 +107,11 @@ org.apache.flex.createjs.staticControls.CheckBox.prototype.set_selected
= functi
 	this.checkMark.visible = this.selected = value;
 	this.element.getStage().update();
 };
+
+/**
+ * @expose
+ * @this {org.apache.flex.createjs.staticControls.CheckBox}
+ */
+org.apache.flex.createjs.staticControls.CheckBox.prototype.clickHandler = function(event)
{
+	this.set_selected(!this.get_selected());
+};


Mime
View raw message