How to make a button click event to call a function that sets a different label text?

I am not an action script developer, but a flash developer, I just want to have a small script application that I will edit a bit so that it interacts with my javascript code.

By the way, I want to have a button and a label on the flash form, when the user clicks on this button, the onclick event calls another function "setText, for example", this setText () function will change the label text.
So I think the code would be something like this:

button_click() { setText(); } void setText() { label1.text='hi'; } 

I managed to put the button and label that I want, only the code that I will write to make this work.

+4
source share
1 answer
 var btn:MovieClip; // reference to your button btn.addEventListener(MouseEvent.MOUSE_DOWN, onBtnMouseDown); function onBtnMouseDown(e:MouseEvent):void { setText(); } function setText():void { label1.text = 'hi'; } 
+1
source

All Articles