The compiler is compiling this code with local vars in the handler
method incorrectly:

<canvas width="1000" height="600">
    <handler name="oninit">
        var i = 1000;
        var starttime = getTimer();
        while (i > 0) {
            i--;
            new lz.view(canvas, {x: i, y: i});
        }

        new lz.text(canvas,{x:0, y:20, text: 'elapsed time: '+getTimer()});
        var ctime = getTimer() - starttime;
        new lz.text(canvas,{x:0, y:30, text: ('initialize new views
time: '+ctime )} );
    </handler>
</canvas>




Each var is ending up as a global, i.e.,

package {
public var ctime = getTimer() - starttime;}


package {
public var i = 1000;}


and then the main app LzApplication.as  looks like

package {

import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
import flash.net.*;
import flash.ui.*;
import flash.text.Font;
public class LzApplication extends LFCApplication {
public function LzApplication() {
canvas = new LzCanvas({$delegates: ["oninit",
"$lzc$handle_oninit$$max$2Elzx_2_28_$m1", null],
$lzc$handle_oninit$$max$2Elzx_2_28_$m1:
/* -*- file: max.lzx#3.1 -*- */
function  () {
with (this) {
while (i > 0) {
i--;
new (lz.view)(canvas, {x: i, y: i})
};
new (lz.text)(canvas, {x: 0, y: 20, text: "elapsed time: " + getTimer()});
new (lz.text)(canvas, {x: 0, y: 30, text: "initialize new views time:
" + ctime})
}}, __LZproxied: "true", bgcolor: 16777215, embedfonts: true,
fontname: "Verdana,Vera,sans-serif", fontsize: 11, fontstyle: "plain",
height: 600, lpsbuild: "8002 /Users/hqm/openlaszlo/devildog",
lpsbuilddate: "2008-02-12T05:11:59-0500", lpsrelease: "RingDing",
lpsversion: "4.1", runtime: "swf9", width: 1000});
addChild(canvas.sprite);
canvas.initDone();
}
}
}


-- 
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to