Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This line makes the button, btnCalculate wait for a mouse click
- // When the button is clicked, the displayDate function is called
- btnCalculate.addEventListener(MouseEvent.CLICK, displayDate);
- // This line makes the textinput, txtinRadius wait for a mouse click
- // When the textinput is clicked, the clearLabels function is called
- txtinYear.addEventListener(MouseEvent.CLICK, clearLabels);
- // This is the displayDate function
- // e:MouseEvent is the click event experienced by the button
- // void indicates that the function does not return a value
- function displayDate(e:MouseEvent):void
- {
- // declare the variables
- var Year:Number;
- var Avalue:Number;
- var Bvalue:Number;
- var Cvalue:Number;
- var Dvalue:Number;
- var Fvalue:Number;
- var Gvalue:Number;
- var Hvalue:Number;
- var Ivalue:Number;
- var Jvalue:Number;
- var Kvalue:Number;
- var Mvalue:Number;
- var Month:Number;
- var Day:Number;
- // calculate the Month and Date
- Year = Number(txtinYear.text)
- Avalue = Year % 19
- Bvalue = Year / 100
- Cvalue = Year % 100
- Dvalue = Bvalue / 4
- Kvalue = Bvalue % 4
- Fvalue = ((8* Bvalue) + 13) / 25
- Gvalue = (( 19 * Avalue) + Bvalue - Dvalue - Fvalue + 15) % 30
- Hvalue = (Avalue + ( 11 * Gvalue)) / 319
- Ivalue = Cvalue / 4
- Jvalue = Cvalue % 4
- Mvalue = ((2 * Kvalue) + (2 * Ivalue) - Gvalue - Hvalue - Jvalue + 32) % 7
- Month = (Gvalue - Hvalue + Mvalue + 90) / 25
- Day = (Gvalue - Hvalue + Mvalue + Month + 19) % 32
- // put the values into the labels
- lblMonth.text = Month.toFixed(0);
- lblDay.text = Day.toFixed(0);
- }
- // This is the clearLabels function
- // e:MouseEvent is the click event experienced by the textinput
- // void indicates that the function does not return a value
- function clearLabels(e:MouseEvent):void
- {
- txtinYear.text = "";
- lblMonth.text = "";
- lblDay.text = "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement