You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.6 KiB

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#FFFFFF"
backgroundAlpha="0"
xmlns:custom="components.*">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function show(event:Event):void {
var day:String = bday.daysCB.selectedItem.toString();
var month:String = bday.monthsCB.selectedItem.toString();
var year:String = bday.yearsCB.selectedItem.toString();
var birthdayString:String = month + ' ' + day + ', ' + year;
var birthdayDate:Date = new Date(bday.yearsCB.selectedItem, bday.monthsCB.selectedIndex,bday.daysCB.selectedIndex + 1);
var now:Date = new Date();
if (birthdayDate.toDateString() == now.toDateString()) {
Alert.show("HAPPY BIRTHDAY " + fullname.text + '!');
} else {
Alert.show("Hello " + fullname.text + '! ' + '\nYour birthday is ' + birthdayString + '.');
}
}
]]>
</mx:Script>
<mx:Form>
<mx:FormHeading label="Tell us your birthday to get a free gift!" />
<mx:FormItem label="Name:">
<mx:TextInput id="fullname" />
</mx:FormItem>
<mx:FormItem label="Your Birthday:"
direction="horizontal">
<custom:ComboBoxDateEntry id="bday" />
</mx:FormItem>
<mx:FormItem>
<mx:Button id="myButton"
label="Submit"
click="show(event)" />
</mx:FormItem>
</mx:Form>
</mx:Application>