[Laszlo-dev] Declaring static class variables in LZX

André Bargull andre.bargull at udo.edu
Tue Jan 20 01:39:00 PST 2009


You can set "allocation" to "class" to get static attributes/methods. 
(The default value for "allocation" is "instance".)

<attribute name="allowed" value="false" type="boolean" allocation="class" />


> Is there a way to declare a static variable for a class in LZX?  Right 
> now we're doing this after the class declaration:
>
>      <script><![CDATA[
>          // Initialize the shared class variables in lz.mediadevice class
>          /*    Shared flag defined in mediadevice.prototype that
>                tracks whether the user has allowed device access.
>                True after user has accepted security dialog,
>                false if the user denies access with security dialog.
>                Note: allowed is not defined in objects, but in the 
> prototype.
>                Initialized in the script at the end of the file.
>                @keywords readonly */
>          lz.mediadevice.allowed = false;
>        ]]>
>      </script>
>
> If we were writing the class in script, we'd be able to do this:
>
> static var allowed = false
>
> -- 
> Regards,
> Max Carlson
> OpenLaszlo.org
>   




More information about the Laszlo-dev mailing list