# Combine on- and onClipEvent-Handler

**URL:** <https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538>\
**Category:** Uncategorized\
**Created:** [June 12, 2002, 3:14pm UTC](https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538 "2002-06-12T15:14:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2002, 3:14pm UTC](https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538/1 "2002-06-12T15:14:23Z")

</div>

Hi!\r\rIs there any possibility to combine those two handlers.\rI want a movieclip changing its scale when a button is pressed.\rThe change I would write as this:\r\ronClipEvent(enterFrame) {\r if (\_scale\<200) {\r \_scale+=10;\r }\r}\rBut I can’t write\ron (release) {\r onClipEvent(enterFrame) {\r …\r\rDo U understand what I want.\rIs there a way to realize it?\r\rMany THX\r\rHartwig

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2002, 4:39pm UTC](https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538/2 "2002-06-12T16:39:46Z")

</div>

the on() handler is for buttons, you can’t put them on movieclips. you could put a button in the movieclip like this\r\ron(press){\rnChange = true\r}\r\rand then the code on the MC would be like this :\r\ronClipEvent(enterFrame) {\rif(nChange){\rif (\_scale\<200) {\r\_scale+=10;\r}\r}\r}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 13, 2002, 5:43am UTC](https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538/3 "2002-06-13T05:43:25Z")

</div>

you can assign an onEnterFrame event within an on(press) like this:

```auto
 \r\ron(press){\r\r this.onEnterFrame = function(){\r\r if(this._scale<200) this._scale += 10;\r\r }\r\r}\r\ron(release){\r\r this.onEnterFrame = null;\r\r}

```

\rincidentally, \_scale isn’t a built in property.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 13, 2002, 6:05am UTC](https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538/4 "2002-06-13T06:05:38Z")

</div>

Wow. so simple. I must have been blind!\rThe only thing I had to change was\r\ron(press){\r\_root.nChange = true\r}\r\rand the code on the MC:\r\ronClipEvent(enterFrame) {\rif(\_root.nChange){\rif (\_scale\<200) {\r\_scale+=10;\r}\r}\r}\r\rThanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 14, 2002, 8:18am UTC](https://forum.kirupa.com/t/combine-on-and-onclipevent-handler/2538/5 "2002-06-14T08:18:16Z")

</div>

Hi Supra!\r\rI haven’t seen your reply before posting mine. What are the consequences that \_scale is not a built in property?\r\rH.
