On 2006-09-07, at 04:52 EDT, Max Carlson wrote:
> That's what I get for sending emails too late at night without
> thinking... Duh!
>
> That said, the example you sent fails to compile - touché:
> event.lzx:3:1: Syntax error: the token "class" was not expected at
> this position.
LPP-2688.
> This version uses the 'less modern' method of declaring the class
> but still fails:
>
> <canvas width="800" height="400">
> <script>
> LzTestEventReg = new Class(
> "LzTestEventReg",
> LzLoader,
> function ( owner , args ) {
> #pragma 'methodName=initialize'
> //todo: this isn't working: why?
> super.initialize(owner, args);
> this.removeLoadCheckerDel =
> new LzDelegate( this, "removeLoadChecker", this,
> "onloaddone" );
> }
> );
> LzTestEventReg.removeLoadCheckerDel = function() {
You still have a type-oh here: you mean to name this function
removeLoadChecker (not Del).
> Debug.write('removeLoadCheckerDel');
> }
>
> LzTestEventReg.testDel = function() {
> this.onloaddone.sendEvent();
> }
> DeclareEvent(LzTestEventReg, 'onloaddone' );
>
> var foo = new LzTestEventReg();
> foo.testDel();
> </script>
> </canvas>
>
> Debug.evalCarefully("event.lzx", 25, (function () {return
> LzTestEventReg;}), this).make is not a function
>
> Shouldn't make() be declared automatically if I don't specify it?
> Where is this going wrong?
>
> -Max
>
> P T Withington wrote:
>> 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