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!
Copy link to clipboard
Copied
Hi.
What exactly are you not being able to do?
Please let us know.
Regards,
JC
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
Copy link to clipboard
Copied
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.