I will repost my _real_ problem shortly

--- In [email protected], "Libby" <[EMAIL PROTECTED]> wrote:
>
> In Adobe® Flex™ 2 Language Reference, the entry for Class DateField,
> this example is at the bottom (click on "Examples"). It won't compile,
> giving an error on the line where DateField is being cast in the
> change event. The error is "1119: Access of possibly undefined
> property selectedDate through a reference with static type DateField."
> 
> I have tried unsuccessfully to understand what is wrong here - could
> someone tell me how Adobe expected this example to work? (I get this
> error all the time when casting stuff).
> 
> Here's the code, ver batim:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <!-- Simple example to demonstrate the DateField control. -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
> 
>     <mx:Script>
>       <![CDATA[
> 
>          // Event handler for the DateField change event.
>          private function dateChanged(date:Date):void {
>             if (date == null)
>                 selection.text = "Date selected: ";                
>             else
>                 selection.text = "Date selected: " +
> date.getFullYear().toString() + 
>                     '/' + (date.getMonth()+1).toString() + '/' +
> date.getDate();
>          }
>       ]]>
>     </mx:Script>
>  
>  <mx:DateFormatter id="df"/>
> 
>     <mx:Panel title="DateField Control Example" height="75%"
width="75%" 
>         paddingTop="10" paddingLeft="10" paddingRight="10">
> 
>         <mx:Label width="100%"  color="blue"
>             text="Select a date in the DateField control. Select it
> again to clear it."/>
> 
>         <mx:Label text="Basic DateField:"/>
>         <mx:DateField id="dateField1" yearNavigationEnabled="true" 
>            
change="dateChanged(DateField(event.target).selectedDate)" />
>         <mx:Label id="selection"  color="blue" text="Date selected:" />
> 
>         <mx:Label text="Disable dates before June 1, 2006."/>
>         <mx:DateField id="dateField2" yearNavigationEnabled="true" 
>             disabledRanges="{[ {rangeEnd: new Date(2006, 5, 1)} ]}" />
>         <mx:Label  color="blue" text="Date selected:
> {df.format(dateField2.selectedDate)}"/>
> 
>     </mx:Panel>
> </mx:Application>
>


Reply via email to