views:

30

answers:

1

i am not an action script developer nor flash designer, i just want to have a small action script sample that i will edit a little to make it interact with my javascript code.

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

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

I managed to put the button and the label i want just the code i will write to make this work.

A: 
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';
}
heavilyinvolved