startup-solo.lzx

<!--
  OOBE bootstrap page.
  Make sure to compile this with lzr=swf6, to make a swf6 SOLO output file.
-->
<canvas width="800" height="600" bgcolor="#677080" proxied="false">
  <debug fontsize="12"/>

  <script>
    var appstart = getTimer();
  </script>

<!--
   <view resource="startup_launching.swf"/> 
-->

   <view resource="startup_launching.png"/> 

  <dataset name="svars" type="http" src="startup.var" request="true"/>
  <dataset name="ping" type="http"/>

 
  <handler name="ondata" reference="svars">
      global.ping_interval = Number(svars.getPointer().xpathQuery("/params/@ping_interval"));
      global.ping_timeout =  Number(svars.getPointer().xpathQuery("/params/@timeout"));
      global.ping_url = svars.getPointer().xpathQuery("/params/@ping_url");
      global.succ_url = svars.getPointer().xpathQuery("/params/@succ_url");
      global.fail_url = svars.getPointer().xpathQuery("/params/@fail_url");

    // set up a task to try to retrieve the ping_url
    ping.timeout = Number(ping_interval);
    Debug.write('ping_interval = ', ping.timeout);

    Debug.write('ping_url = ', ping_url);

    global.pdel = new LzDelegate(ping, 'doRequest');
    ping.setSrc(ping_url);
    ping.doRequest();

  </handler>


  <handler name="ondata" reference="ping">
      Debug.write('SUCCESS: lz.Browser.loadURL(',succ_url,');');
      lz.Browser.loadURL(succ_url);
  </handler>

  <handler name="ontimeout" reference="ping">
      Debug.write('ping.ontimeout');
      canvas.checkloaded();
  </handler>

  <handler name="onerror" reference="ping">
    
      Debug.write('ping.onerror, elapsed ', (getTimer() - appstart));
      if ( (getTimer() - appstart)  > ping_timeout) {
          Debug.write('FAIL: lz.Browser.loadURL(',fail_url,');');
          lz.Browser.loadURL(fail_url);
      } else {
          lz.Timer.addTimer(global.pdel, ping_interval);
      }
    
  </handler>


  <method name="checkloaded">
    
      Debug.write('checkloaded, elapsed ', (getTimer() - appstart));
      if ( (getTimer() - appstart)  > ping_timeout) {
          Debug.write('FAIL: lz.Browser.loadURL(',sparams.fail_url,');');
          lz.Browser.loadURL(sparams.fail_url);
      } else {
          ping.doRequest();
      }
    
  </method>


  <!--
    This is what we get from startup.var:

    <params ping_url="http://localhost:8080/lps-@V ERSIONID@/lps/utils/test.lzx?lzt=xml"
            succ_url="http://localhost:8080/lps-@V ERSIONID@/laszlo-explorer/"
            fail_url="startup_error.html" timeout="360000" ping_interval="5000" pad="pad"
    />

    
  -->

<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2001-2010 Laszlo Systems, Inc.  All Rights Reserved.              *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->



</canvas>

Cross References

Named Instances