[Laszlo-dev] ERROR: Attempt to instantiate <foo>, which has not been defined

Henry Minsky hminsky at laszlosystems.com
Wed Dec 31 11:41:29 PST 2008


I think the only thing missing in that script is the code to add the
tag to the tag table, e.g.,

  lz[$lzc$class_foo.tagname] = $lzc$class_foo;

The setter that is in the code she posted doesn't actually send any
event, but I assume that's just
that test case, and in the real code the "ontype" event or whatever is
being properly sent by the setter
if needed.

I think the other protocol stuff, creating the 'attributes' list and
calling the constructor super() method
are correct. I can't recall if there is anything else necessary to
implement an LZX class.



On Wed, Dec 31, 2008 at 1:33 PM, P T Withington <ptw at pobox.com> wrote:
> I think we converted everything, but we didn't do video or things in the
> incubator.
>
> On 2008-12-31, at 12:30EST, Sarah Allen wrote:
>
>> The a/v extensions are written this way (I didn't write them).  Their
>> setters aren't being called which make the test files not work.  I was
>> trying to isolate why the setter wasn't called, so I wrote that test file.
>>  Max worked around the bug we were seeing this morning in the change I
>> approved earlier.  We figured the best thing is to refactor all of the a/v
>> extensions with LZX syntax as they used to be.
>> Is there anywhere else that private internal protocol is used? If so,
>> there may be other bugs as a result of those changes.
>>
>> Thanks,
>> Sarah
>>
>> P T Withington wrote:
>>>
>>> The private internal protocol for translating an LZX class to a JS class
>>> has changed (to accomodate the new runtimes).  Your test case is out of
>>> date.
>>>
>>> Is there some compelling reason that you are not just writing your class
>>> as a class?  That would avoid a lot of trouble.
>>>
>>> On 2008-12-31, at 10:13EST, Sarah Allen wrote:
>>>
>>>> I was trying to isolate a bug where the type setter wasn't being called
>>>> for videoview with the test file below.  The dynamic class/interface stuff
>>>> is new for me.  Can someone tell me what I did wrong?
>>>>
>>>> I get this runtime error in the debugger:
>>>>   ERROR: Attempt to instantiate <foo>, which has not been defined
>>>>
>>>> <canvas><interface name="foo" extends="view">       <!--- Protocol
>>>> "rtmp" or "http". Default: http. -->       <attribute name="type"
>>>> value="http" type="string"/></interface><switch>   <when runtime="dhtml">
>>>>     <!-- no support for foo in DHTML runtime --> </when>   <otherwise>
>>>> <script when="immediate"><![CDATA[       // Classes that implement an
>>>> interface must obey the LZX       // tag->class mapping convention
>>>> dynamic class $lzc$class_foo extends LzView {         // Next two are part
>>>> of the required LFC tag class protocol           static var tagname = 'foo';
>>>>           static var attributes = new LzInheritedHash(LzView.attributes);
>>>>         static var uid = 0;        function $lzc$class_foo(parent, attrs,
>>>> children, async) {               super(parent, attrs, children, async);
>>>>       } override function init() {               super.init();
>>>> if (this.debug) {                   if ($debug) Debug.write("foo.init()"); }
>>>>        }         function $lzc$set_type(newtype) { Debug.write("videoview
>>>> setType", newtype, "old", this['type'], "isinited", this.isinited, "stream",
>>>> this['stream']);               //if (newtype == undefined) newtype = 'http';
>>>>               this.type = newtype;               //Debug.write('type',
>>>> this.type); // _setType called before init or stream is define, so tip-toe.
>>>> if (this['stream']) {                   this.stream.setAttribute("type",
>>>> newtype);               }           }       }         ]]></script>
>>>> </otherwise> </switch><foo/></canvas>
>>>
>>
>
>



-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com


More information about the Laszlo-dev mailing list