Ok, I see what you're saying. So here's the constructor for my component that is responsible for all this:
public function CreateAcctDialog() { super(); init(); } ...and init(): private function init():void { msgString = "<b>The account " + this.acctName + " has been created </b>" } and the last part: content.htmlText = msgString; This comes out as: The account null has been created. I thought the init() method would handle the proper setting of this var..... --- In flexcoders@yahoogroups.com, "valdhor" <valdhorli...@...> wrote: > > For the first part, you are setting the value of msgString during its > declaration. At this point acctName will be null. You would need to declare > msgString and then assign it in a creationComplete handler. > > Secondly, you can't do this in ActionScript: > > content.htmlText = "{msgString}" > > You have to do this: > > content.htmlText = msgString > > The "{}" syntax is to bind a variable in MXML. > > Also, For the above, the variable does not need to be bindable. > > > > > --- In flexcoders@yahoogroups.com, "fumeng5" <fumeng5@> wrote: > > > > Thanks for your responses. > > > > What I mean is that in the 1st case: > > content.htmlText = "<b>The account " + this.acctName + " has been > > created</b>." > > > > ...the message comes out to be: The account null has been created. However, > > I can use the debugger to see that acctName is definitely being set > > correctly. > > > > And in the second case: > > [Bindable] > > private var msgString:String = "<b>The account " + this.acctName + " > > hasbeen created </b>. > > > > content.htmlText = "{msgString}" > > > > ...the message comes out to be: {msgString} > > > > Now I'm not setting 'msgString' right away. I build it in the setter for > > acctName, as in: > > [Bindable] > > private var msgString:String; > > > > public function set acctName(s:String):void{ > > _acctName = s; > > msgString = "<b>The account " + _acctName + " has been created </b>" > > } > > [Bindable] > > public function get acctName():String{ > > return _acctName; > > } > > > > I'm pretty sure this should be working and I must be missing something > > small. Thank you for your help, it's very appreciated. > > > > > > > > --- In flexcoders@yahoogroups.com, Pedro Sena <sena.pedro@> wrote: > > > > > > try > > > > > > [Bindable] > > > private var msgString:String = "<b>The account " + this.acctName + " has > > > been created </b>. > > > > > > content.htmlText = "{msgString}" > > > > > > and make sure your acctName is not blank. > > > > > > On Thu, Apr 30, 2009 at 9:55 AM, valdhor <valdhorlists@>wrote: > > > > > > > > > > > > > > > What do you mean by "That didn't work"? > > > > > > > > > > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, > > > > "fumeng5" <fumeng5@> wrote: > > > > > > > > > > Hi -- > > > > > > > > > > I want to output a variable and hardcoded text in the htmlText > > > > > property > > > > of a Text component. > > > > > > > > > > Here's what I tried first: > > > > > > > > > > content.htmlText = "<b>The account " + this.acctName + " has been > > > > > created > > > > </b>." > > > > > > > > > > ('acctName' is a private var that has accessor methods to get/set it.) > > > > > > > > > > That didn't work, so I read thru the archives and found a solution > > > > > that > > > > didn't work either. > > > > > > > > > > [Bindable] > > > > > private var msgString:String = "<b>The account " + {acctName} + " has > > > > been created </b>. > > > > > > > > > > content.htmlText = "{msgString}" > > > > > > > > > > What am I missing here? Can anyone offer any helpful pointers? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > /** > > > * Pedro Sena > > > * Systems Architect > > > * Sun Certified Java Programmer > > > * Sun Certified Web Component Developer > > > */ > > > > > >