[Laszlo-user] setting variables at build time with lzc

Henry Minsky henry.minsky at gmail.com
Fri Jan 4 19:54:23 PST 2008


The compiler options passed in via the -D... command line args are
eaten by the compiler, they aren't passed through as key/values into
the compiled app code.

I don't think we have an option to pass in code to initialize
arbitrary variables in the compiled app.
It would be pretty easy to implement in the compiler, but I don't
remember actually supporting that.

For now you would have to modify your source code to set constants to
get compiled in.

There is a trick though, in Flash runtime anyway, where any query args
that you use to fetch the app with
are initialized as globals in the app. So if you say

http://foo.com/myapp.lzx?flavor=vanilla

you will magically find the "flavor" var bound to "vanilla" at runtime.

At least, that used to work in older  SWF players, I'm not sure if it
still does.








On Jan 4, 2008 10:32 PM, andrew m. boardman <amb at mit.edu> wrote:
>
> Hi, all.  I'm trying to use lzc (with 4.0.2) to pass in a simple string at
> build time; to quote the usage message:
>
> Options:
> -D<name>=<value>
>   Set the name/var property to value (See Compiler.getProperties).
>
> I haven't actually been able to *use* this option to set anything visible
> within my OpenLaszlo code; it seems to be neither a global variable
> (which is what someone else here was expecting) nor a property of
> anything obvious.
>
> Anyone using this functionality who can point me in the right direction?
> Am I being oblivious to something here, or is it as obscure (to a new
> OpenLaszlo developer, at least) as it seems?
>
> Thanks for any clues.
>



-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com


More information about the Laszlo-user mailing list