[Laszlo-dev] [Platform-team] System calls

Henry Minsky hminsky at laszlosystems.com
Sat Sep 13 22:32:49 PDT 2008


To expand on this, I'm working on the debugger GUI component now, and it
almost compiles in swf9, except that I need some lines of runtime-specific
code to instantiate a loader class for doing eval() requests to the server.

In swf8, the code is

this.evalloader =  new LzLoader(this.sprite, { attachname: 'debugloader' });

in swf9, it needs to be

        this.evalloader = new Loader();
        this.evalloader.contentLoaderInfo.addEventListener(Event.INIT,
debugEvalListener);

LzLoader is an internal swf8 kernel class, while Loader and Event.INIT are
as3
library classes.

So I'm not sure what the most expedient way to deal with this is.

I was thinking maybe something like using the <switch> tag to conditionalize
creating different code at the level of methods, but I still need some way
to insert the "import flash.xx.*;" statements into the class declaration
that gets generated. If I had the proposed <passthrough> tag, it might looks
like

<class name="LzDebugWindow" >
  <switch>
    <when runtime="swf9">
        <passthrough context="class">
             import flash.util.*;
             import flash.events.*;
        </passthrough>
      <method name="makeEvalLoader">
        debugloader = new Loader();
        debugloader.contentLoaderInfo.addEventListener(Event.INIT,
debugEvalListener);
      </method>
      <method name="debugEvalListener" args="event:Event">
         ...
      </method>
    </when>
    <otherwise>
      <method name="makeEvalLoader">
        return new LzLoader(this.sprite, { attachname: 'debugloader' });
      </method>
    </otherwise>
</switch>



In this case, it might or might not be better to structure the
LzDebugWindow as an abstract base class with everything except the
runtime-specific methods, and then have the debugger/Library.lzs
include a runtime-specific final class which would define those
methods, so I'd have a common file with

    <class name="LzBaseDebugWindow">
    ...
    </class>

and then make mutually exclusive swf8 and swf9 files which defined the
runtime-specific methods. But I'd still need this <passthrough> tag to
get the import statements forced into the intermediate script code.

<library>
  <switch>
    <when runtime="swf8">
      <include href="swf8debugger.lzx">
    </when>
    <when runtime="dhtml">
     <!-- no debugger component in dhtml -->
    </when>
    <when runtime="swf9">
      <include href="swf9debugger.lzx"/>
    </otherwise>
  </switch>
</library>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080913/75a6a9de/attachment.html


More information about the Laszlo-dev mailing list