Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib/customs/textzone.js
diff options
context:
space:
mode:
authorLaurent Bernabe <laurent.bernabe@gmail.com>2014-03-20 22:33:57 (GMT)
committer Laurent Bernabe <laurent.bernabe@gmail.com>2014-03-20 22:33:57 (GMT)
commit307b0f7e265b22181c6362c162c068806505cff2 (patch)
tree55e026541ba49582ded5a97705cd0018933bc83e /lib/customs/textzone.js
parentcbc53de61019293f742680fd7062f212be7bc91b (diff)
Now I avoid creating new Text object whenever I need to change the textbox content.
Diffstat (limited to 'lib/customs/textzone.js')
-rw-r--r--lib/customs/textzone.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/customs/textzone.js b/lib/customs/textzone.js
index 386cd47..c1a34d9 100644
--- a/lib/customs/textzone.js
+++ b/lib/customs/textzone.js
@@ -15,6 +15,7 @@ TextZone.prototype = {
this.stage.addChild(this.text);
this.stage.update();
},
+ // Just call it once.
addToStage: function(){
var txtZone = new createjs.Shape();
txtZone.graphics.beginFill(this.backgroundColor).drawRect(
@@ -26,7 +27,7 @@ TextZone.prototype = {
changeTextTo: function(newText){
this.stage.removeChild(this.text);
- this.text = new createjs.Text(newText, this.fontStr, this.textColor);
+ this.text.text = newText;
this.text.lineWidth = this.width;
this.text.x = this.x;
this.text.y = this.y;