[Laszlo-user] Creating new base classes with the new keyword?
P T Withington
ptw at pobox.com
Fri Jul 18 06:26:40 PDT 2008
On 2008-07-17, at 23:18EDT, Kenneth Miller wrote:
> Is it possible to programmatically create new user interface methods
> through scripting?
>
> var new_window = new window()?
Yes, but LZX classes are in a pseudo-namespace, you would actually
have to say:
var new_window = new lz.window(...
and, you need to know that all view (and subclass) constructors take
the following arguments:
parent: the view that it will be a child of
attributes: a hash (Object) of initial attribute values
children: an Array of child view descriptors (see below)
Alternatively, you can invoke:
<someview>.makeChild(...
Which takes a descriptor {Object} that has the following properties:
'class': the class of the view you want to instantiate, e.g., lz.window
attrs: initial attribute values
children: Array of child view descriptors
Note that neither of these API's is officially supported as a public
API, apparently, because I cannot find this information in the
documentation?
> Also,
> Is there a way to see the names defined in the current namespace,
> sort of like python's dir() function in the debug interpreter?
In swf8 and DHTML the 'current namespace' is called `global`. If you
say Debug.inspect(global) you will see everything.
The swf8 debugger also supports completion. Start typing, hit tab and
you will get a list of possibilities.
More information about the Laszlo-user
mailing list