Quantity Counter Buttons

New Here ,
Jan 20, 2022 Jan 20, 2022

Copy link to clipboard

Copied

I'm brand new to Animate so be gentle as I have no idea what I'm doing 🙂

 

I'd like to create a way of recording a quantity on the last frame in my project by using plus and minus buttons to count up or down. 

 

Below is old code, but this is along the lines of what I'm trying to achieve:

 

add.btn.addEventListener(MouseEvent.CLICK, addone);
var count = 0;
counting.text = count;
function addone (event:Event){
count ++;
counting.text = count;
}

 

Can anyone help me figure out what I need to do? Thank you!

TOPICS
ActionScript

Views

28

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 20, 2022 Jan 20, 2022

Copy link to clipboard

Copied

Hi.

 

What exactly are you not being able to do?

 

Please let us know.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 20, 2022 Jan 20, 2022

Copy link to clipboard

Copied

Hi JC, thank you for reaching out. I can't get the code to work, and I'm not sure I've got the Actionscript right as it was from a very old Youtube tutorial here: https://www.youtube.com/watch?v=dkIDL-O1U-Q

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 20, 2022 Jan 20, 2022

Copy link to clipboard

Copied

LATEST

Are you getting any error?

 

I think your instance name may be wrong.

 

You wrote:

add.btn.addEventListener(MouseEvent.CLICK, addone);

 

But maybe it should be:

addBtn.addEventListener(MouseEvent.CLICK, addone);
add.addEventListener(MouseEvent.CLICK, addone);

 

Or something else?

 

Your way will only work if you have an instance called add and then another instance inside of it called btn.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines