Cool bug! Please file at (http://jira.openlaszlo.org).
Why? Because your superclass, `lz.view`, has an attribute `play`,
which has a setter. [And Javascript is a "Lisp 1": functions and
variables are in the same namespace, rather than separate namespaces,
as is the case in some dialects.] When you define a method `play`,
the compiler/runtime handles that the same as you defining an
attribute `play`: it passes it to the play setter (which starts or
stops the view from playing, depending on the value being set).
I would consider this a bug. Surely if you override an attribute
with a method in a subclass, you should also override any setter
associated with the attribute?
As a work-around, you could add the following method to your test class:
<method name="setPlay" args="value">
this.addProperty('play', value);
</method>
This will override the setter in your superclass and correctly
install your play method. Of course, that will mean your subclass
will not obey the normal play protocol of views.
On 2007-06-18, at 22:48 EDT, Robin Sheat wrote:
With the test class included, it seems that you can't override the
'play'
method of a class, but can override the others (well, 'stop'
anyway). Why is
this? This is with lps-3.3.3.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE canvas SYSTEM "http://www.openlaszlo.org/lps-latest/tools/
lzx.dtd">
<canvas width="500" height="500" debug="true">
<class name="test">
<method name="play">
Debug.write("play was called");
</method>
<method name="stop">
Debug.write("stop was called");
</method>
</class>
<test name="testplay"/>
<button text="Go!">
<handler name="onclick">
canvas.testplay.play();
canvas.testplay.stop();
</handler>
</button>
</canvas>
--
Robin <[EMAIL PROTECTED]> JabberID:
<[EMAIL PROTECTED]>
Hostes alienigeni me abduxerunt. Qui annus est?
PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C
EB6D