OnClip Event to timeline as

I’m trying to have an animation occur on a timeline and not on Enter frame, so instead of it doing a continuous loop it just does the animation twice then stops. Currently this code is on the movie clip itself and I want to move it to the main as code line so it animates then stops. Any way to change this to a function or something? Sorry I’m more of a designer…:sonic:

onClipEvent (enterFrame) {
rpm = 35
}
onClipEvent (enterFrame) {
_parent.oscillateUsingCos(rpm);
_parent.spin(this, “horizontal”);
}