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.