# Color change prototype delete please

**URL:** https://forum.kirupa.com/t/color-change-prototype-delete-please/82014
**Category:** flash
**Created:** [March 7, 2005, 2:18am UTC](https://forum.kirupa.com/t/color-change-prototype-delete-please/82014 "2005-03-07T02:18:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![novetree](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@novetree](https://forum.kirupa.com/u/novetree)
#### Post date: [March 7, 2005, 2:18am UTC](https://forum.kirupa.com/t/color-change-prototype-delete-please/82014/1 "2005-03-07T02:18:08Z")

</div>

Would someone be so kind as to add an “if statement” that will delete the onEnterFrame upon arrival at the new color in the following prototype? Thank you

MovieClip.prototype.fadeColor = function(cto, ease) {  
var myColor = new Color(this), cColor = myColor.getTransform();  
this.onEnterFrame = function() {  
for (var c in cColor) {  
cColor[c] += (cto[c]-cColor[c])/ease;  
}  
myColor.setTransform(cColor);  
};  
};
