# With() statement and function literals

**URL:** <https://forum.kirupa.com/t/with-statement-and-function-literals/198058>\
**Category:** Uncategorized\
**Created:** [August 22, 2006, 3:29am UTC](https://forum.kirupa.com/t/with-statement-and-function-literals/198058 "2006-08-22T03:29:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeMumps](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MikeMumps](https://forum.kirupa.com/u/MikeMumps)\
**Post date:** [August 22, 2006, 3:29am UTC](https://forum.kirupa.com/t/with-statement-and-function-literals/198058/1 "2006-08-22T03:29:37Z")

</div>

Hello everybody,

So this is the setup:

I have a flash movie with a button that is attached with attachMovie(). The button is my\_btn. I use a with() statement to set it’s properties:

```auto

attachMovie("my_btn", "my_btn", 0);
with(my_btn) {
     _x = 50;
     _y = 50;
     onRelease = function () {
          trace("Hello from my_btn.");
     }
}

```

The x and y properties are fine, but the onRelease function does not work. Does somebody know a solution for this?

My solution was to not use the with() statement at all, but I’d be interested in knowing if it’s possible to declare function literals using a with() statement.

Thanks!  
Mike M.
