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 displayDebtBurden function is called
- btnCalculate.addEventListener(MouseEvent.CLICK, displayDebtBurden);
- // This is the displayDebtBurden function
- // e:MouseEvent is the click event experienced by the button
- // void indicates that the function does not return a value
- function displayDebtBurden(e:MouseEvent):void
- {
- // declare the constants
- const INITIAL:Number = 481.5;
- // declare the variables
- var year2007:Number;
- var year2008:Number;
- var year2009:Number;
- var year2010:Number;
- // calculate the debt burden per year
- year2008 = INITIAL * 0.97
- year2009 = year2008 * 0.97
- year2010 = year2009 * 0.97
- // put the values into the labels
- lblyear2007.text = INITIAL.toFixed(1);
- lblyear2008.text = year2008.toFixed(1);
- lblyear2009.text = year2009.toFixed(1);
- lblyear2010.text = year2010.toFixed(1);
- }
Add Comment
Please, Sign In to add comment