[flexcoders] Label not updating properly

2007-11-08 Thread bloodylag
Ok I have a label in my flex app.

mx:Label bottom=0 left=0 textAlign=center text=Start Date:
{dispDate} width=100% height=5% /

The dispDate is defined as

[Bindable]
public var dispDate:Date = new Date();

then in an init function I update the date through flashvars which
javascript is passing in a millisecond time.

dispDate.setTime(Application.application.parameters.startTime);

I can alert the dispDate and it shows the updated date, but the label
doesn't update and is just the current date...

how can I make it update.

thanks




Re: [flexcoders] Label not updating properly

2007-11-08 Thread Scott Melby
I would bet that the binding just looks for changes to the value of 
dispDate not to changes in its attributes.  You should be able to verify 
this by setting your compiler to keep generated code, then go look 
through what it generates.  But, operating on this assumption, I would 
say your two options are to update your dispDate as follows

dispDate = new Date(Application.application.parameters.startTime)

or alternatively set it the way you are, then manually update your label 
with something like myLabel.invalidateDisplayList().


hth
Scott

Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com



bloodylag wrote:


Ok I have a label in my flex app.

mx:Label bottom=0 left=0 textAlign=center text=Start Date:
{dispDate} width=100% height=5% /

The dispDate is defined as

[Bindable]
public var dispDate:Date = new Date();

then in an init function I update the date through flashvars which
javascript is passing in a millisecond time.

dispDate.setTime(Application.application.parameters.startTime);

I can alert the dispDate and it shows the updated date, but the label
doesn't update and is just the current date...

how can I make it update.

thanks