[ka-Map-users] Detection: Map and Javascript loaded

Javier Pascual Herranz javier.pascual at radmas.com
Wed Oct 31 12:19:09 EDT 2007


Detection: Map and Javascript loaded
------------------------------------

The file index.html contains the following:

<body onload="myOnLoad();">

Meaning: While loading the site, the following function is executed:

function myOnLoad() {
...
...
myKaMap.registerForEvent( KAMAP_INITIALIZED, null, myInitialized ); ...
...

myKaMap.initialize( szMap, szExtents, szCPS ); }

In this function, a series of events is called. The one interesting us, is
the following:

myKaMap.registerForEvent( KAMAP_INITIALIZED, null, myInitialized );

Meaning, that on ocurring the event "KAMAP_INITIALIZED", the javascript
function myInitialized() should be executed:

function myInitialized() {
	alert("Map Loaded");
}

The last instruction executed inside the function myOnLoad() should be:

myKaMap.initialize( szMap, szExtents, szCPS );

This function is defined in the file kamap.js

kaMap.prototype.initialize = function() { .. call(szURL, this,
this.initializeCallback); ..
}

At the same time, the previous function calls the function

kaMap.prototype.initializeCallback = function( szInit ) {
    // szInit contains /*init*/ if it worked, or some php error otherwise
    if (szInit.substr(0, 1) != "/") {
        this.triggerEvent( KAMAP_ERROR, 'ERROR: ka-Map! initialization '+
                          'failed on the server.  Message returned was:\n'
+
                          szInit);
        return false;
    }

    eval(szInit);
    this.triggerEvent( KAMAP_INITIALIZED );

    this.initializationState = 2;
 
};

This very function I need to check if the received param "szInit" contains
the character / in the its position. If not, it causes and "error"
initializing the site. But if it has the character, the map has loaded
correctly and the function related to "KAMAP_INITIALIZED" will be executed.
In my case:

function myInitialized() {
	alert("Map Loaded");
}

AND NOW THE PROBLEM:
The message "Map Loaded" I put shows up before the map and all the other
items (images, icons, etc.) have been loaded entirely

I'M HALLUCIONATING WITH THIS!! IS THERE ANYONE WHO CAN HELP ME SOLVING THIS
PROBLEM?!
















More information about the ka-Map-users mailing list