Mike,

You can use data binding to accomplish what you want to do (if I
understand your question correctly). Take a look at the code below.
You can see a working example with source code at
http://robsondesign.com/flexcoders/globalDateDisplay/globalDateDisplay.html

HTH
Jim

1. Here's a slightly modified version of your MXML component (I didn't
want to extend the Date class). I called it DateDisplay.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%">
<mx:Script><![CDATA[
public function setMasterDate(d:Date):void
{
MasterDate.text = d.month + "/" + d.date + "/" + d.fullYear;
}
]]>
</mx:Script>
<mx:Label id="MasterDate" text="October 13, 2006"
fontFamily="Georgia" fontSize="16" textAlign="left" x="85"
width="201.5" height="26" fontWeight="bold" top="9"/>
</mx:Canvas>

2. Here's another MXML component that invokes the setMasterDate
method. It's called DateControl.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
height="400">
<mx:Script>
<![CDATA[
public var dateDisplay:DateDisplay;
]]>
</mx:Script>
<mx:DateChooser id="dateChooser" x="25" y="100" />
<mx:Button id="button" label="Go"
click="dateDisplay.setMasterDate(dateChooser.selectedDate)" x="50"
y="300" />
</mx:Canvas>

2. Here's the main application MXML file:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns:local="*">
<local:DateDisplay id="dateDisplay" />
<local:DateControl id="dateControl" dateDisplay="{dateDisplay}" />
</mx:Application>




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to