Alex,
I tried it initially and it did not worked.
Found out the reason. The label control is inside a datagrid control column
and what I did was I prepended the function call with the word "outerDocument"
like:
<mx:Label id="LabelDay1" text="{outerDocument.setDayName( 1,1,2009) }"
horizontalCenter="true" />
And I also set the function to Public so it is accessible to the label control.
Am I correct in setting the function to be public?
Thanks.
Regards,
Angelo
________________________________
From: Alex Harui <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Friday, 18 September, 2009 13:38:27
Subject: RE: [flexcoders] Label Control Text Value Coming From a Function Call
Did you try it? I would expect that to work.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs. adobe.com/ aharui
From:flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On
Behalf Of Angelo Anolin
Sent: Thursday, September 17, 2009 8:10 PM
To: flexcod...@yahoogro ups.com
Subject: [flexcoders] Label Control Text Value Coming From a Function Call
Hi FlexCoders,
I have a label control where the text value that should be displayed is coming
from a defined function.
For example:
<mx:Label id="LabelDay1" text="" horizontalCenter="true" />
private function setDayName(monthNo: Number, dayNo:Number, yearNo:Number)
:String
{
// Make some calculations on the day based on the date parameter passed.
//......
.....
//Assuming the day value is returned after parsing the date value parameters.
return 'Monday'
}
Is it possible to assign that the LabelDay1 object would display in the text
the value returned by the function setDayName. Please take note that I have a
lot of instances of the label control which is inside a datagrid column
control's header renderer so placing them in a function outside would be
tedious.
Would this be possible:
<mx:Label id="LabelDay1" text="{setDayName( 1,1,2009) }"
horizontalCenter="true" />
Appreciate your response. Thanks.
Regards,
Angelo