2003/10/20 01:41:22
[org.ibex.core.git] / src / org / xwt / builtin / splash.xwt
1 <xwt>
2
3     <template thisbox="window" orient="vertical" width="394" height="276">
4
5         KeyPressed += function(k) { if (k == "escape") thisbox = null; }
6
7         var progress = function(n, d) {
8             xwt.println("loaded " + 100 * (n/d) + "%");
9             $innerbar.width = $bar.width * n / d;
10         }
11
12         xwt.thread = function() {
13             var img = xwt.org.xwt.builtin["splash.png"];
14             xwt.println("img is");
15             xwt.println(img);
16             fill = img;
17             xwt.yield();
18             x = (xwt.screenWidth - width) / 2;
19             y = (xwt.screenHeight - height) / 2;
20             var origin = xwt.origin;
21             if (origin.substring(0, 21) == "http://launch.xwt.org") {
22                 origin = origin.substring(22);
23                 origin = "http://" + origin.substring(origin.indexOf('/') + 1);
24             }
25             xwt.println("origin is " + origin);
26             var new_rr = xwt.watchProgress(xwt.load(origin), progress);
27             var new_xwt = xwt.clone(new_rr);
28         }
29
30         <box packed="false" id="bar" x="20" y="236" width="354" height="19" align="left">
31             <box id="innerbar" fill="blue" width="0"/>
32         </box>
33
34     </template>
35