sdust_cloud
老张小宅
2017-02-28 05:56

skyline 在JavaScript下不执行OnProjectLoadFinished中的代码

  • skyline
  • javascript

skyline版本6.6.1
OnProjectLoadFinished注册成功,函数中加入alert("OK");后一切正常,注释掉就不执行之后的代码,请教

代码如下:

 <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <title>test</title>
        <script type="text/javascript">
        /**
         *
         *初始化页面,加载工程,监听工程加载完毕事件
         *
         */
        function Init() {
            try {
                //fly文件路径
                var flyPath = "http://www.csmap.gov.cn/threedmap/fly/Default.fly";
                //添加onloadFinished事件
                TE.AttachEvent("OnLoadFinished", OnProjectLoadFinished);
                //打开工程
                TE.Project.Open(flyPath);
            }
            catch (e) {
                alert("Error: " + e.description);
            }
        }
        function OnProjectLoadFinished(bSuccess){
            //alert("Received project loaded event: " + ((bSuccess) ? "Success" : "Failure"));
            var tyg = TE.Creator.CreatePosition(112.98,28.18,1000,40,300,-90);
            TE.Navigate.FlyTo(tyg);             
        }
        </script>
    </head>
    <body onload="Init()"> 
        <!--定义TerraExplorer的信息窗口对象-->
        <object ID="TEInformationWindow" classid="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" BorderStyle ="4" width="300" height="400"></object>
        <!--定义一个TerraExplorer 3D窗口对象-->
        <object ID="TE3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" BorderStyle ="4" width="650" height="400"></object>
        <!--定义TerraExplorer对象-->
        <object ID="TE" CLASSId="CLSID:3A4F9199-65A8-11D5-85C1-0001023952C1"></object>
    </body>
</html>
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换