Default Script Timeout

Hi,
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("http://myUrl.com/getData.php");
    rangeRequest.requestHeaders.push(header);
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, rangeCompleteHandler);
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.load(rangeRequest);
}

function rangeCompleteHandler(event:Event):void {


    var rangeId:int = int(event.target.data.rangeId);
    var rangeStart:Number = Number(event.target.data.rangeStart);
    var rangeEnd:Number = Number(event.target.data.rangeEnd);


    if (rangeId != -1) {
        
        rangeStartTxt.text = rangeStart.toString();
        rangeEndTxt.text = rangeEnd.toString();
        trace(rangeId)
        //trace(rangeEnd);
        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;
        variables.total = numPrimes;
        var totalRequest:URLRequest = new URLRequest();
        totalRequest.url = "http://myUrl.com/sendProcessedItems.php";
        totalRequest.data = variables;
        var loader:URLLoader = new URLLoader();
        loader.dataFormat = URLLoaderDataFormat.TEXT;
        loader.addEventListener(Event.COMPLETE, rangeCountCompleteHandler);
        loader.load(totalRequest);
    } 
}
function rangeCountCompleteHandler(event:Event):void {

    getNewItemsRange();
}

//start it up
getNewItemsRange();

I also considered the solution on this website:
http://blog.justgreat.nl/2007/08/24/joy-with-the-script-timeout-period/

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

thanks