Updated Express TextInput to add prompt bead only when needed.

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

Branch: refs/heads/feature/fontawesome
Commit: 22d7b008611b9e896cc97390d0642218ae0c54c7
Parents: c5a3eee
Author: Peter Ent <[email protected]>
Authored: Wed Jan 4 10:31:29 2017 -0500
Committer: Peter Ent <[email protected]>
Committed: Wed Jan 4 10:31:29 2017 -0500

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/express/TextInput.as   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22d7b008/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
 
b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
index 7cb96c8..f79c2fe 100644
--- 
a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
+++ 
b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
@@ -34,10 +34,6 @@ package org.apache.flex.express
                public function TextInput()
                {
                        super();
-                       
-                       _promptBead = new TextPromptBead();
-                       _promptBead.prompt = "";
-                       addBead(_promptBead);
                }
                
                private var _promptBead:TextPromptBead;
@@ -48,12 +44,19 @@ package org.apache.flex.express
                 */
                public function get prompt():String
                {
-                       return _promptBead.prompt;
+                       return _promptBead ? _promptBead.prompt : null;
                }
                
                public function set prompt(value:String):void
                {
-                       _promptBead.prompt = value;
+                       if (_promptBead == null) {
+                               _promptBead = new TextPromptBead();
+                               _promptBead.prompt = value ? value : "";
+                               addBead(_promptBead);
+                       }
+                       else {
+                               _promptBead.prompt = value ? value : "";
+                       }
                        dispatchEvent(new Event("promptChanged"));
                }
                

Reply via email to