# Calling the on(press) event handler

**URL:** https://forum.kirupa.com/t/calling-the-on-press-event-handler/294425
**Category:** flash
**Created:** [August 13, 2009, 8:00pm UTC](https://forum.kirupa.com/t/calling-the-on-press-event-handler/294425 "2009-08-13T20:00:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zeldalink](https://avatars.discourse-cdn.com/v4/letter/z/94ad74/32.png) [@zeldalink](https://forum.kirupa.com/u/zeldalink)
#### Post date: [August 13, 2009, 8:00pm UTC](https://forum.kirupa.com/t/calling-the-on-press-event-handler/294425/1 "2009-08-13T20:00:58Z")

</div>

**Preface**

Typically when you set an event handler function for buttons by code, like:

```auto
mybutton.onPress = function(){
   trace("Hello!");
}

```

you can access and call this event handler function by:

```auto
mybutton.onPress();

```

and it will execute the function and trace “Hello!”.

**My question**

But when you set event handlers on the button itself, like:

```auto
on(press){
   trace("Hello!");
}

```

is that event function accessible from code? how? I know there would be a property that you can access it by, maybe we can “decompile” an SWF to check out finally which property it stores the event code in, or would any of you have any idea?

```auto
mybutton.onPress(); // This does not work!

```
