You are exactly right! It worked perfectly when I added a listener for the 
creationComplete event in my constructor and set the handler to be init. 

I learned something new today. Thank you very, very much for your help. 
--- In [email protected], "valdhor" <valdhorli...@...> wrote:
>
> I don't believe you need that. I do what you are doing all the time although 
> I don't do it in the init method (I am assuming you are calling the init 
> method on initialize of the component?). I would try calling it on 
> creationComplete (That's what I do). You may find that the initialize method 
> runs before you get a chance to set acctName.
> 
> 
> --- In [email protected], "fumeng5" <fumeng5@> wrote:
> >
> > The String I'm constructing is inside a PopUp dialog bog. I set it from 
> > another component a la:
> > 
> > private function createAcct():void {
> > 
> >     acctDialog.acctName   = accountName;
> >     PopUpManager.addPopUp(acctDialog,this as Canvas,true);
> > }
> > 
> > The accessor methods for acctName look like this:
> > 
> > private var _acctName:String;
> > public function set acctName(s:String):void{
> >     acctName = s;
> > }
> > [Bindable]
> > public function get acctName():String{
> > return _acctName;
> > }
> > 
> > And I set the content.htmlText property in the init() method when acctName 
> > is null. So, I think the solution is to use binding utils in the init() 
> > method, like this:
> > 
> > BindingUtils.bindProperty(content,'htmlText',msgString);
> > 
> > but I think I'm missing an argument in there...i think it needs 4 args. 
> > 
> > Thank you very much for your help. 
> > 
> > 
> > 
> > 
> > 
> > --- In [email protected], "valdhor" <valdhorlists@> wrote:
> > >
> > > How is acctName created?
> > > 
> > > 
> > > --- In [email protected], "fumeng5" <fumeng5@> wrote:
> > > >
> > > > 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 [email protected], "valdhor" <valdhorlists@> 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.
> > >
> >
>


Reply via email to