# Trigger a button Via Code?

**URL:** <https://forum.kirupa.com/t/trigger-a-button-via-code/249116>\
**Category:** flash\
**Created:** [January 15, 2008, 3:57pm UTC](https://forum.kirupa.com/t/trigger-a-button-via-code/249116 "2008-01-15T15:57:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xohol](https://avatars.discourse-cdn.com/v4/letter/x/59ef9b/32.png) [@xohol](https://forum.kirupa.com/u/xohol)\
**Post date:** [January 15, 2008, 3:57pm UTC](https://forum.kirupa.com/t/trigger-a-button-via-code/249116/1 "2008-01-15T15:57:30Z")

</div>

Hello, im making the switch to AS3, and ive been coming across a few things once so simple that are confusing me a bit.

How do i trigger a button action via code?

in as2, i would simply type something like this

[AS]button.onRelease = releaseFunction  
button.onRelease()[/AS]

and the button would act like it was released.

in AS3, i can tell the button what function to call, but how do i tell the button to fire?

[AS]button.addEventListener (MouseEvent.MOUSE\_UP, bRelease);[/AS]

…since [AS]button.onRelease()[/AS] doesn’t work?

thanks  
Q
