Hello mapguide users, 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.Here is some sample code using the 
AJAX viewer :In the first page I have :<[EMAIL PROTECTED] 
file="utilityfunctionsMapguide.jsp" %>

<%
    /* Initialize a JSP session and register a variable to hold the session id,
    then initialize the Web Extensions, and connect to the site, and create a 
session. */

    try {
        createSessionMapguide(request);
    } catch (Throwable t) {
        response.sendRedirect("errorPageMapguide.jsp?ERROR=" + t.getMessage());
    }

%>

<html>

<head>
    <script type="text/javascript">
        var timeout;
        function executeActions() {
            if (document.getElementById("viewerFrame").readyState == 
"complete") {
                clearTimeout(timeout);
                var tempWin = 
window.open('ajaxviewerMapguideScriptFrame.jsp?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>&GUID=<%=GUID%>',
 'scriptFrame', '');
            } else {
                timeout = setTimeout("executeActions()", 500);
            }
        }
    </script>
</head>

<body marginheight="0" marginwidth="0" onload=" <%
                                                    if (GUID != null) {%>
                                                        executeActions()
                                                    <%}%>">

<iframe id="viewerFrame" name="ify" width="100%" height="100%" frameborder=0 
scrolling="no"
        
src="/mapguide/mapviewerajax/?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>"/>


</body>
</html>

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 loadedThe 
<ajaxviewerMapguideScriptFrame.jsp> page has the following content:<html>
<head>
    <%
        String sessionId = request.getParameter("SESSION");
        String webLayout = request.getParameter("WEBLAYOUT");
        String GUID = request.getParameter("GUID");
    %>
    <script type="text/javascript">
        var t;
        function onPageLoad() {
            if (parent.mapFrame.mapInit) {
                clearTimeout(t);
                
window.open('ajaxviewerMapguideJS.jsp?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>&GUID=<%=GUID%>',
 'scriptFrame', '');
            } else {
                t = setTimeout("onPageLoad()", 500);
            }

        }
    </script>
</head>

<body onload="onPageLoad()">

</body>

</html>
 From what I have read from the DWF API I have to use something like 
this<object id="ADViewer" 
        classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" 
        border="1" width="400" height="400" VIEWASTEXT>
        <param name="Src" 
                
value="http://download.autodesk.com/global/dwf/gallery/files/085825-1-zobell_residence.dwf";>
        </object>
and this<script type="text/javascript" for="ADViewer" 
event="OnEndLoadItem(bstrItemType,vData,vResult)">
 
  if (bstrItemType == 'DOCUMENT')
  {
 //Indicates the document is finished loading
 ListSections();
  }
 
 </script>

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  ?
 



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to