# Spin or Turn, but not both

**URL:** <https://forum.kirupa.com/t/spin-or-turn-but-not-both/131384>\
**Category:** Uncategorized\
**Created:** [December 15, 2004, 7:13am UTC](https://forum.kirupa.com/t/spin-or-turn-but-not-both/131384 "2004-12-15T07:13:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc0047](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@marc0047](https://forum.kirupa.com/u/marc0047)\
**Post date:** [December 15, 2004, 7:13am UTC](https://forum.kirupa.com/t/spin-or-turn-but-not-both/131384/1 "2004-12-15T07:13:44Z")

</div>

I’m finally trying my hand at using prototypes and loving it. I’ve encountered a minor snag which I know has an easy work around, but I don’t exactly know how to phrase my question succinctly for a google search:

I have built two class prototypes for MovieClip, and I’m utilizing them both at the same time:

//Code begins  
MovieClip.prototype.turn = function (angle) {  
this.onEnterFrame = function () {  
this.\_rotation += angle;  
}  
}

MovieClip.prototype.scale = function (change) {  
this.onEnterFrame = function() {  
this.\_xscale += change;  
this.\_yscale += change;  
}  
}

sq1.turn(2);  
sq1.scale(2);

//Code ends

What happens here is that only the last function that is called actually works. In this case, only scale works. Calling turn() ahead of scale(), makes only turning work. I suspect it’s because they share the same onEnterFrame event.

Is there a better way to write these functions?
