[Laszlo-dev] Is there a way to make this work in both swf8 and swf9 ?

André Bargull andre.bargull at udo.edu
Sun Oct 5 15:27:43 PDT 2008


This pattern is used for the service classes: first declaration, then 
the definition. Works there for swf8 and swf9.

<script when="immediate" ><![CDATA[
    public class LzQName {
      static var XSD_STRING;
      LzQName.XSD_STRING = new LzQName("string", 
LzNamespace.URI_DEFAULT_SCHEMA_XSD);
      function LzQName(type:String, uri:String) {
      }
    }
  ]]></script>

> >/
> />/
> />/ It should work in both runtimes to just leave out the name of the class,
> />/ since static vars are 'in scope' of the class body.
> />/
> /
> OK that works for that case, but there's another case that's causing an
> error in swf8, which is when the thing tries to instantiate an instance of
> itself as a static var initializer, e.g.,
>
> public class LzQName {
> static var XSD_STRING =
>     new LzQName("string", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
>
>
> <a title="#75">ERROR @rpc/library/qname.js#130: call to undefined function
> 'LzQName'</a>
>   



More information about the Laszlo-dev mailing list