Mapping probem!plzzz help mee

hii friends,

im now working on a project to draw map dynamically.
the projection is done using Mercator projection,
so for each state minlat,minlon maxlat,maxlon is taken from database using php and then it’s projected using mercator function written in flash.

    The problem is that the map is loading VERY SLOWLY.

is it because of all the mathematical functions done in flashmx itself?
my mercator functio is like this

function Mercator ( origin, scale )
{

this.F = function ( lat ) {
		var sinlat = math.sin( math.abs(lat) );
		var esinlat = this.e * SinLat;
		var Ym = math.log( (1+SinLat)/(1-SinLat) * 
			  math.pow( (1-esinlat)/(1+esinlat), this.e)
		) * 0.5;
		if ((lat < 0 && Ym > 0) || (lat > 0 && Ym < 0)) {
			Ym = - Ym;
		}
		return Ym;
		trace("Ym"+Ym);
}

var p=3432.371  // WGS-84 Model
var q=3443.918

this.XYres = new Planar( 0, 0 );
this.e2 = 1 - (p * p) / (q * q);  // e squared
this.e = math.sqrt( this.e2 );

this.MinLL = new Spherical( origin.lat, origin.lon);
this.MaxLL = new Spherical( origin.lat, origin.lon);

this.NewScale( origin.lat, scale );

this.Fmin = this.F( toRad(origin.lat) );

}