# Execution Timeout Error - Not and Infinite Loop!

**URL:** https://forum.kirupa.com/t/execution-timeout-error-not-and-infinite-loop/303524
**Category:** flash
**Created:** [January 21, 2010, 4:41pm UTC](https://forum.kirupa.com/t/execution-timeout-error-not-and-infinite-loop/303524 "2010-01-21T16:41:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ivode](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ivode](https://forum.kirupa.com/u/ivode)
#### Post date: [January 21, 2010, 4:41pm UTC](https://forum.kirupa.com/t/execution-timeout-error-not-and-infinite-loop/303524/1 "2010-01-21T16:41:48Z")

</div>

I have been getting the following error occasionally when running my flash file.

Error #1502: A script has executed for longer than the default timeout period of 15 seconds.  
at Sr\_fla::CenterTemperature\_10/frame2()

After the error occurs I can dismiss it and the error will not reoccur unless the flash file is closed and reopened - even though I am running the same code over and over. I have traced out all of my loops and feel confident there is not and infinite loop.

I read a note on the forums that mentioned this error can occur when a large calculation takes place. I am doing some semi-complex calculations. Maybe that is the cause. Below I have posted some snippets of code from my work. Essentially I have a script which tests a variable (CenterTemperature) to make sure it is within certain bounds. Then a looping movieclip reads the variable and scales another movieclip accordingly.

Reference position code:  
if( ManualRangeOn ){  
if( ((CenterTemperature + TemperatureIncrement) + (TemperatureSpan/2)) \>= DeviceTemperatureMax ) { //test for high temp above max  
if( (TemperatureSpan - TemperatureIncrement) \<= TemperatureSpanMin ){ //test for span too small  
TemperatureSpan = TemperatureSpanMin;  
CenterTemperature = DeviceTemperatureMax - (TemperatureSpan/2);  
}  
else{ //span not too small  
TemperatureSpan = TemperatureSpan - TemperatureIncrement;  
CenterTemperature = DeviceTemperatureMax - (TemperatureSpan/2);  
}  
}  
else{  
CenterTemperature = CenterTemperature + TemperatureIncrement; //everything is ok, increase level   
}  
}

Looping Movieclip Code:

if( this.parent != null )  
{  
if( MovieClip(root).ManualRangeOn )  
{  
TemperatureSpan = MovieClip(root).TemperatureSpan;  
CenterTemperature = MovieClip(root).CenterTemperature;

```
	ScaledGradient.scaleX = TemperatureSpan/(DeviceTemperatureMax - DeviceTemperatureMin);
	ScaledGradient.x = int(((ScaledGradientMaxX-ScaledGradientMinX)*((CenterTemperature - (TemperatureSpan/2))/(DeviceTemperatureMax - DeviceTemperatureMin))+ScaledGradientMinX)-BottomGradientHolderX);
	
	BlackBackground.x = GradientBackground.x;
	BlackBackground.width = (ScaledGradient.x + ScaledGradient.width/2) - BlackBackground.x;
	
}

```

}

I am fairly new to Flash so any insight would be greatly appreciated.
