# Make Button's Function Execute Once Without Buttong Being Pressed

**URL:** https://forum.kirupa.com/t/make-buttons-function-execute-once-without-buttong-being-pressed/297174
**Category:** flash
**Created:** [September 26, 2009, 8:27pm UTC](https://forum.kirupa.com/t/make-buttons-function-execute-once-without-buttong-being-pressed/297174 "2009-09-26T20:27:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Plasmic\_Steve](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/plasmic_steve/32/361_2.png) [@Plasmic\_Steve](https://forum.kirupa.com/u/Plasmic_Steve)
#### Post date: [September 26, 2009, 8:27pm UTC](https://forum.kirupa.com/t/make-buttons-function-execute-once-without-buttong-being-pressed/297174/1 "2009-09-26T20:27:38Z")

</div>

Hello. I’m new to ActionScript 3. Here’s my problem.

I have a function that executes when a button is pressed:

btnRandomAll.addEventListener(MouseEvent.CLICK, clickHandlerBtnRandomAll);  
function clickHandlerBtnRandomAll(e:Event)  
{

…but, I need it to also execute once, upon the file loading.

Can someone tell me how that can be done? Thanks.

Steve
