<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><P>Hello mapguide users, </P><P></P><P>I've been reading the DWF viewer API and still didn't find a solution of how to find out when a map has loaded using the DWF viewer. For the AJAX viewer it works like a charm.</P><P></P><P>Here is some sample code using the AJAX viewer :</P><P></P><P>In the first page I have :</P><P></P><P><%@include file="utilityfunctionsMapguide.jsp" %><BR><BR><%<BR> /* Initialize a JSP session and register a variable to hold the session id,<BR> then initialize the Web Extensions, and connect to the site, and create a session. */<BR><BR> try {<BR> createSessionMapguide(request);<BR> } catch (Throwable t) {<BR> response.sendRedirect("errorPageMapguide.jsp?ERROR=" + t.getMessage());<BR> }<BR><BR>%><BR><BR><html><BR><BR><head><BR> <script type="text/javascript"><BR>
var timeout;<BR> function executeActions() {<BR> if (document.getElementById("viewerFrame").readyState == "complete") {<BR> clearTimeout(timeout);<BR> var tempWin = window.open('ajaxviewerMapguideScriptFrame.jsp?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>&GUID=<%=GUID%>', 'scriptFrame', '');<BR> } else {<BR> timeout = setTimeout("executeActions()", 500);<BR> }<BR> }<BR> </script><BR></head><BR><BR><body marginheight="0" marginwidth="0" onload=" <%<BR> if (GUID != null) {%><BR> executeActions()<BR> <%}%>"><BR><BR><iframe id="viewerFrame" name="ify" width="100%" height="100%" frameborder=0 scrolling="no"<BR>
src="/mapguide/mapviewerajax/?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>"/><BR><BR><BR></body><BR></html><BR><BR>As you can see here when the iframe has loaded I open a new jsp page <ajaxviewerMapguideScriptFrame.jsp> where I test if the map has loaded</P><P></P><P>The <ajaxviewerMapguideScriptFrame.jsp> page has the following content:</P><P></P><P><html><BR><head><BR> <%<BR> String sessionId = request.getParameter("SESSION");<BR> String webLayout = request.getParameter("WEBLAYOUT");<BR> String GUID = request.getParameter("GUID");<BR> %><BR> <script type="text/javascript"><BR> var t;<BR> function onPageLoad() {<BR> if (parent.mapFrame.mapInit) {<BR> clearTimeout(t);<BR>
window.open('ajaxviewerMapguideJS.jsp?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>&GUID=<%=GUID%>', 'scriptFrame', '');<BR> } else {<BR> t = setTimeout("onPageLoad()", 500);<BR> }<BR><BR> }<BR> </script><BR></head><BR><BR><body onload="onPageLoad()"><BR><BR></body><BR><BR></html><BR> </P><P>From what I have read from the DWF API I have to use something like this</P><P></P><P><object id="ADViewer" <BR>         classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" <BR>         border="1" width="400" height="400" VIEWASTEXT><BR>         <param name="Src" <BR>                 value="http://download.autodesk.com/global/dwf/gallery/files/085825-1-zobell_residence.dwf"><BR>         </object><BR></P><P></P><P>and this</P><P></P><P><script type="text/javascript" for="ADViewer" event="OnEndLoadItem(bstrItemType,vData,vResult)"><BR> <BR> if (bstrItemType ==
'DOCUMENT')<BR> {<BR> //Indicates the document is finished loading<BR> ListSections();<BR> }<BR> <BR> </script><BR><BR>ok, but how do I implement this into my code, where should I put it, because I have an iframe tag that uses a webLayout not a dwf file ?</P><P><BR> <BR><BR></P></td></tr></table><br>__________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com