You left out the superclass. Er, and you forgot to call the
superclass initialize method from your initialize method. Um, and
you didn't define the removeLoadChecker method (you tried to, but you
named it removeLoadCheckerDel). Other than that...
BTW, The 'modern' way to say what you want is:
<script>
class LzTestEventReg extends LzMediaLoader {
function initialize ( owner , args ) {
super.initialize ( owner, args);
//todo: this isn't working: why?
this.removeLoadCheckerDel =
new LzDelegate( this, "removeLoadChecker", this, "onloaddone" );
}
function removeLoadChecker () {
Debug.write('removeLoadCheckerDel');
}
var onloaddone = LzDeclaredEvent;
function testDel () {
this.onloaddone.sendEvent();
}
}
var foo = new LzTestEventReg();
foo.testDel();
</script>
On 2006-08-31, at 18:49 EDT, Max Carlson wrote:
> Hi,
>
> I'm trying to make a simple test case that creates a class with a
> custom constructor. It's based on the LzMediaLoader class in the
> LFC. I want to keep it as similar the the LFC class as possible.
> Can you take a look and tell me what I got wrong? In DHTML it
> fails due to 'too much recursion' creating the class, while SWF
> does even less:
>
>
> <canvas width="800" height="400">
> <script>
> LzTestEventReg = new Class(
> "LzTestEventReg",
> function ( owner , args ) {
> //todo: this isn't working: why?
> this.removeLoadCheckerDel =
> new LzDelegate( this, "removeLoadChecker", this,
> "onloaddone" );
> }
> );
>
> LzTestEventReg.prototype.removeLoadCheckerDel = function() {
> Debug.write('removeLoadCheckerDel');
> }
>
> LzTestEventReg.prototype.testDel = function() {
> this.onloaddone.sendEvent();
> }
> DeclareEvent(LzTestEventReg.prototype, 'onloaddone' );
>
> var foo = new LzTestEventReg();
> foo.testDel();
> </script>
> </canvas>
>
>
> Thanks!
>
> -Max
_______________________________________________
Laszlo-dev mailing list
Laszlo-dev@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev