# Extremely Easy Question about Rollout

**URL:** <https://forum.kirupa.com/t/extremely-easy-question-about-rollout/57278>\
**Category:** flash\
**Created:** [July 12, 2004, 1:20am UTC](https://forum.kirupa.com/t/extremely-easy-question-about-rollout/57278 "2004-07-12T01:20:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RadioactveChimp](https://avatars.discourse-cdn.com/v4/letter/r/7feea3/32.png) [@RadioactveChimp](https://forum.kirupa.com/u/RadioactveChimp)\
**Post date:** [July 12, 2004, 1:20am UTC](https://forum.kirupa.com/t/extremely-easy-question-about-rollout/57278/1 "2004-07-12T01:20:08Z")

</div>

I have this code attached to a button:

onClipEvent (enterFrame) {  
\_root.xInit = 150;  
\_root.yInit = 150;

```
if (_root._ymouse &gt; 50 && _root._ymouse &lt; 150) {
    _root.yChange = Math.round(_root._ymouse-this._y);
    _root.xChange = Math.round(_root._xmouse-this._x);
    _root.yMove = Math.round(_root.yChange/20);
    _root.xMove = Math.round(_root.xChange/20);
    this._y += _root.yMove;
    this._x += _root.xMove;
}
else {
	_root.yChange = Math.round(this._y - 60);
	_root.xChange = Math.round(this._x - 50);
	_root.yMove = Math.round(_root.yChange/20);		
	_root.xMove = Math.round(_root.xChange/20);
	this._x -= _root.xMove;
	this._y -= _root.yMove;
}

}instanceName.

```

onRollOutustomEasing = {};  
customEasing.pts = [{Mx:0,My:0,Nx:18,Ny:-236,Px:2,Py:-19},{Mx:20,My:-255,Nx:16,Ny:-96,Px:2,Py:119},{Mx:38,My:-232,Nx:30,Ny:186,Px:3,Py:-148},{Mx:71,My:-194,Nx:22,Ny:-46,Px:8,Py:37},{Mx:101,My:-203,Nx:30,Ny:24,Px:1,Py:-21},{Mx:132,My:-200,Nx:28,Ny:-6,Px:4,Py:6},{Mx:164,My:-200,Nx:40,Ny:2,Px:-4,Py:-2},{Mx:200, My:-200}];  
customEasing.ease = function(t,b,c,d,pl){  
var i,r;  
r = 200 \* t/d;  
for(i = 0;r\>pl[i+1].Mx;i++){  
}  
i=pl\*;  
if(i.Px != 0){  
r=(-i.Nx+Math.sqrt(i.Nx_i.Nx-4_i.Px\*(i.Mx-r)))/(2_i.Px);  
}else{  
r=-(i.Mx-r)/i.Nx;  
}  
return b-c_((i.My+i.Ny_r+i.Py_r\*r)/200);  
}

Flash says:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 22: Statement must appear within on/onClipEvent handler  
}instanceName.

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 24: Statement must appear within on/onClipEvent handler  
customEasing.pts = [{Mx:0,My:0,Nx:18,Ny:-236,Px:2,Py:-19},{Mx:20,My:-255,Nx:16,Ny:-96,Px:2,Py:119},{Mx:38,My:-232,Nx:30,Ny:186,Px:3,Py:-148},{Mx:71,My:-194,Nx:22,Ny:-46,Px:8,Py:37},{Mx:101,My:-203,Nx:30,Ny:24,Px:1,Py:-21},{Mx:132,My:-200,Nx:28,Ny:-6,Px:4,Py:6},{Mx:164,My:-200,Nx:40,Ny:2,Px:-4,Py:-2},{Mx:200, My:-200}];

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 25: Statement must appear within on/onClipEvent handler  
customEasing.ease = function(t,b,c,d,pl){

Total ActionScript Errors: 3 Reported Errors: 3

how do I fix this

-Dean

---

<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:** [July 12, 2004, 1:32am UTC](https://forum.kirupa.com/t/extremely-easy-question-about-rollout/57278/2 "2004-07-12T01:32:37Z")

</div>

onClipEvent (enterFrame) {  
\_root.xInit = 150;  
\_root.yInit = 150;  
if (\_root.\_ymouse\>50 && \_root.\_ymouse\<150) {  
\_root.yChange = Math.round(\_root.\_ymouse-this.\_y);  
\_root.xChange = Math.round(\_root.\_xmouse-this.\_x);  
\_root.yMove = Math.round(\_root.yChange/20);  
\_root.xMove = Math.round(\_root.xChange/20);  
this.\_y += \_root.yMove;  
this.\_x += \_root.xMove;  
} else {  
\_root.yChange = Math.round(this.\_y-60);  
\_root.xChange = Math.round(this.\_x-50);  
\_root.yMove = Math.round(\_root.yChange/20);  
\_root.xMove = Math.round(\_root.xChange/20);  
this.\_x -= \_root.xMove;  
this.\_y -= \_root.yMove;  
}  
instanceName.onRollOut = function() {  
customEasing.pts = [{Mx:0, My:0, Nx:18, Ny:-236, Px:2, Py:-19}, {Mx:20, My:-255, Nx:16, Ny:-96, Px:2, Py:119}, {Mx:38, My:-232, Nx:30, Ny:186, Px:3, Py:-148}, {Mx:71, My:-194, Nx:22, Ny:-46, Px:8, Py:37}, {Mx:101, My:-203, Nx:30, Ny:24, Px:1, Py:-21}, {Mx:132, My:-200, Nx:28, Ny:-6, Px:4, Py:6}, {Mx:164, My:-200, Nx:40, Ny:2, Px:-4, Py:-2}, {Mx:200, My:-200}];  
customEasing.ease = function(t, b, c, d, pl) {  
var i, r;  
r = 200_t/d;  
for (i=0; r\>pl[i+1].Mx; i++) {  
}  
i = pl_;  
if (i.Px != 0) {  
r = (-i.Nx+Math.sqrt(i.Nx_i.Nx-4_i.Px\*(i.Mx-r)))/(2_i.Px);  
} else {  
r = -(i.Mx-r)/i.Nx;  
}  
return b-c_((i.My+i.Ny_r+i.Py_r\*r)/200);  
};  
};  
}

error free, but onClipEvent (enterFrame) events can be used with movie clips only.

---

<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:** [July 12, 2004, 7:36pm UTC](https://forum.kirupa.com/t/extremely-easy-question-about-rollout/57278/3 "2004-07-12T19:36:00Z")

</div>

ummm… i dont no what ur trying to do but… u cant have an event handler on a button… u need

on(release){

}

---

<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:** [July 13, 2004, 12:06am UTC](https://forum.kirupa.com/t/extremely-easy-question-about-rollout/57278/4 "2004-07-13T00:06:56Z")

</div>

hmm

well i want to make this: [http://www.phantomplanet.com/](http://www.phantomplanet.com/)  
and I have this: [http://www.actionscript.org/tutorials/beginner/Simple\_Magnetic\_Menu/index.shtml](http://www.actionscript.org/tutorials/beginner/Simple_Magnetic_Menu/index.shtml)

I wanted to add some elastic type things to the code

you understand? lol

-Thanks a lot

Deano
