-
- xwt.loadArchive(origin, function(num, den) {
- $left.flex = 50 * (num / den);
- $right.flex = 50 + 50 * (1.0 - num /den);
- var pct = xwt.math.ceil(num * 100 / den);
- if (1024 > num) {
- num = "" + num + " bytes";
- } else if (1024 * 1024 > num) {
- num = "" + xwt.math.ceil(num / 1024) + "kb";
- } else {
- num = "" + xwt.math.ceil(num / (1024 * 1024)) + "Mb";
- }
- $status.text = "Downloading: " + pct + "% [" + num + "]";
- });
-
- xwt.newBox("main", function(num, den) {
- $left.flex = 50 + 50 * (num / den);
- $right.flex = 50 * (1.0 - num / den);
- if ($right.flex == 0) $right.width = 0;
- $status.text = "Initializing: " + xwt.math.ceil(num * 100 / den) + "%";
- });
-
- thisbox = null;
+ var new_rr = xwt.unzip(xwt.watchProgress(xwt.load(origin), progress));
+ var new_xwt = xwt.clone(new_rr);
+
+ xwt.thread = function() {
+for(var i=0; 100>i; i++) {
+progress(i, 100);
+xwt.yield();
+}
+ new_xwt.apply(xwt.box, new_xwt["main.xwt"]);
+ thisbox = null;
+ }