Opening a Project

This sample demonstrates event handling in the context of opening a project. It shows how to set the parameters for opening the project, retrieve a project interface and then open the project. This example uses the IProject80 (Open), IApplication80 (ExecutablePath), SGWorld (AttachEvent) and SGWorld (OnLoadFinished) properties and methods.

 

function LoadFly()

      {

      varflyPath = @"C:\SomePath\SomeFile.fly";

 

      // C. Register to OnLoadFinished globe event

      sgworld.AttachEvent("OnLoadFinished", OnProjectLoadFinished);

      // default load is in async mode

      sgworld.Project.Open(flyPath);

      alert("Opening project " + flyPath + " in async mode");

      }

 

      function OnProjectLoadFinished(bSuccess)

      {

      alert("Received project loaded event: " + ((bSuccess) ? "Success" : "Failure"));

      }