Default Script Timeout

I was trying to code a script but I keep getting this error:

“Error #1502: A script has executed for longer than the default timeout period of 15 seconds.”

So after googling this for a while, I found you could change this in the publish settings (I’m using flash cs3 pro) and it everything was going fine while I was doing my testing in the IDE. The script ran for a long time (>5 minutes) but the player allowed it to do it’s thing and didn’t complain till the computation was done. However when I put this on my server, I got that error again, I’m stumped.

It’s a very simple script which is on frame one of the flash file:

function getNewItemsRange():void {
    var header:URLRequestHeader = new URLRequestHeader("pragma", "no-cache");
    var rangeRequest:URLRequest = new URLRequest("");
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, rangeCompleteHandler);
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;

function rangeCompleteHandler(event:Event):void {

    var rangeId:int = int(;
    var rangeStart:Number = Number(;
    var rangeEnd:Number = Number(;

    if (rangeId != -1) {
        rangeStartTxt.text = rangeStart.toString();
        rangeEndTxt.text = rangeEnd.toString();
        var numItems:Number = processItems(rangeStart,rangeEnd); //TAKES A VERY LONG TIME (>5 minutes)
        totalTxt.text = numPrimes.toString();

        var variables:URLVariables = new URLVariables();
        variables.rangeId = rangeId; = numPrimes;
        var totalRequest:URLRequest = new URLRequest();
        totalRequest.url = ""; = variables;
        var loader:URLLoader = new URLLoader();
        loader.dataFormat = URLLoaderDataFormat.TEXT;
        loader.addEventListener(Event.COMPLETE, rangeCountCompleteHandler);
function rangeCountCompleteHandler(event:Event):void {


//start it up

I also considered the solution on this website:

but in my case, I don’t just want to catch the error and stop, I want to catch the error and keep the loop going.

if anyone has seen this before, I would appreciate the help