[Laszlo-dev] Re: Dynamic libraries and resources

Henry Minsky henry.minsky at gmail.com
Fri Jan 7 21:06:08 PST 2005


> 
> For this to work, you do need to know which library a view or instance
> is in.  LzInstantiate could set this, for example if the beginning of
> each library set a global to the value of the current library and the
> end unset it (not sure if this works if two libraries are loading at
> once, though).

We can add any preamble or post-amble code we want to
SWFWriter.openSnippet() and closeSnippet(). These get called at the
start end end of generating code for libraries.
There's already a line of script that gets added as the final code to
execute when a library loads, which is the callback to let the LFC
know it has finished loading:

    public void closeSnippet() throws IOException {
        // Make sure we stop
        addScript("this._parent.loader.snippetLoaded(this, null)");
        Program program = new Program();
        program.stop();
        program.none();
        addProgram(program);



> 
> This implementation strategy would have the advantage that it would
> have the side effect of implementing named dynamic resources, e.g.
> <resource name="logo" src="http:logo.jpg"/>.  This has been a frequent
> request.
> 
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>


More information about the Laszlo-dev mailing list