# \[FMX\]Tempory overwriting of function

**URL:** <https://forum.kirupa.com/t/fmx-tempory-overwriting-of-function/101819>\
**Category:** Uncategorized\
**Created:** [February 14, 2004, 2:32pm UTC](https://forum.kirupa.com/t/fmx-tempory-overwriting-of-function/101819 "2004-02-14T14:32:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)\
**Post date:** [February 14, 2004, 2:32pm UTC](https://forum.kirupa.com/t/fmx-tempory-overwriting-of-function/101819/1 "2004-02-14T14:32:29Z")

</div>

I declared the folowing fuction for the onRollOver -and onRollOut state of three buttons:

[AS]this.onEnterFrame=function(){  
for (var i in this){   
if (this\*._name.substr(0, 6) == "sound_")  
{   
this\*.onRollOver = function() {   
new Color(this).setRGB(0xCCCCCC);   
}   
this\*.onRollOut = function()  
{   
new Color(this).setRGB(0xA4Ae8B);   
}   
}  
}  
}  
[/AS]

I also want to add an onRelease state wich overwrite the onRollOver -and onRollOut part of the function and set the new Color to (0XFFFFFF) and start a new song. The first part of the function should work again when one of the other two buttons is pressed.

I tried it by adding the following code, but it isn’t working:

[AS]this\*.onRelease = function() {  
delete this\*.onRollOver;  
delete this\*.onRollOut;   
new Color(this).setRGB(0xFFFFFF);   
}[/AS]

What am I doing wrong?
