# Can't get my script to work without looping over 2 frames

**URL:** <https://forum.kirupa.com/t/cant-get-my-script-to-work-without-looping-over-2-frames/254850>\
**Category:** Uncategorized\
**Created:** [March 16, 2008, 9:45am UTC](https://forum.kirupa.com/t/cant-get-my-script-to-work-without-looping-over-2-frames/254850 "2008-03-16T09:45:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoo\_buffalo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/zoo_buffalo/32/2467_2.png) [@zoo\_buffalo](https://forum.kirupa.com/u/zoo_buffalo)\
**Post date:** [March 16, 2008, 9:45am UTC](https://forum.kirupa.com/t/cant-get-my-script-to-work-without-looping-over-2-frames/254850/1 "2008-03-16T09:45:21Z")

</div>

hey!  
i’ve got a problem i need to work out. i have some script that only works when i have the main timeline looping over 2 frames, i guess it resets the script every time it loops. problem is, it’s resetting everything, reloading the external .as file each time. this is making the site increasingly sluggish. i realise i could make a seperate .as file with just the code i want to reload, and set it up so that it just refreshes this code each time… BUT there must be a better way :glasses: here’s the code in question:

```auto
// planet animations //
this.planets.webPlanet.onRelease = function() {

	Tweener.addTween(this._parent,{_frame:24, time:0.6, transition:"easeInOutSine"});
};

this.planets.illustrationPlanet.onRelease = function() {

	this._parent.gotoAndStop(50);
	Tweener.addTween(this._parent,{_frame:72, time:0.6, transition:"easeInOutSine"});

};

this.planets.fabricPlanet.onRelease = function() {

	this._parent.gotoAndStop(25);
	Tweener.addTween(this._parent,{_frame:49, time:0.6, transition:"easeInOutSine"});

};

```

so. these onRelease functions work fine the first time, but as soon as one of thems been run, none of them work the next time i try. UNLESS the code’s looping over 2 frames. can anyone give me any pointers? i know i’m not always the sharpest tool in the box when it comes to coding! i’m hoping i’m missing something simple! thanks guys!  
emma.
