CalculateRepayment - plays the calculate frame. Later, we'll add validation
to this function.
setRepaymentTerm - sets the value of the intRepayments variable
StartOver - plays the first frame of the movie
floor - used to round the repayment to two decimal places
Add the code shown below to the first frame of the functions layer.
function CalculateRepayment(component) {
gotoAndPlay("calculate");
}
function setRepaymentTerm(component) {
intRepayments = component.getSelectedItem().data;
}
function StartOver() {
gotoAndPlay("start");
}
function floor(number) {
return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
}
Test the movie. If you click the Calculate button, the second frame should
display. Then you can click the New Calculation button to go back to the
first frame.