Skip to main content
Known Participant
March 4, 2022
Question

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")
}
}

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    March 4, 2022

    unless your stage height is 1200px or greater, lower the font size in totaltext if you're not seeing the text update prior to clicking the next button..  ie, 73pt is a large font size.

    Known Participant
    March 5, 2022

    thanks...

    but can you please help me in one more thing

    i do not know why this error appearing i tried everything and im feeling helpless now.

    please help me.

     

    why my frame 2 and frame 3 button showing error.

    im sharing my FLA file it is (AIR for desktop file).

     

    https://drive.google.com/file/d/1xRSMw__igtqbUhsTt89qwKYlDhisDWTh/view

    kglad
    Community Expert
    Community Expert
    March 5, 2022

    i don't download and correct files, unless i'm hired.

     

    that said, i did view your attached images and don't see reloaD01 or reloadD02 in your code, but it must be some where.