action Script 3.0
- March 4, 2022
- 1 reply
- 789 views
In the image "01"
I want the number from highlighted textbox to the highlighted textbox in image"02
this is my code.
stop();
var total: int = 0;
totaltext.text = total.toString();
opt01.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event: MouseEvent): void {
total = total + 10;
totaltext.text = total.toString();
opt01.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
}
opt02.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_4);
function fl_MouseClickHandler_4(event: MouseEvent): void {
total = total - 2;
totaltext.text = total.toString();
opt02.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_4);
}
opt03.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_5);
function fl_MouseClickHandler_5(event: MouseEvent): void {
total = total - 2;
totaltext.text = total.toString();
opt03.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_5);
}
opt04.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_6);
function fl_MouseClickHandler_6(event: MouseEvent): void {
total = total - 2;
totaltext.text = total.toString();
opt04.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_6);
}
//---------------------------------------------------------------------------//
opt0201.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_7);
function fl_MouseClickHandler_7(event: MouseEvent): void {
total = total - 2;
totaltext.text = total.toString();
opt0201.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_7);
}
opt0202.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_8);
function fl_MouseClickHandler_8(event: MouseEvent): void {
total = total - 2;
totaltext.text = total.toString();
opt0202.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_8);
}
opt0203.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
function fl_MouseClickHandler_2(event: MouseEvent): void {
total = total + 10;
totaltext.text = total.toString();
opt0203.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
}
opt0204.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_9);
function fl_MouseClickHandler_9(event: MouseEvent): void {
total = total - 2;
totaltext.text = total.toString();
opt0204.removeEventListener(MouseEvent.CLICK, fl_MouseClickHandler_9);
}
next.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event: MouseEvent): void {
if (total >= 13) {
gotoAndStop(2);
} else if (total < 13) {
gotoAndStop(3);
}
else {
trace("Complete All Questions")
}
}
