I thought it was preferable to use class objects that are in 'lz' object
rather than global[classname]
Are the lz.* potentially going to go away?
-e
P T Withington wrote:
eval is very limited in the swf runtime. It can only evaluate var and
member expressions.
Are you just trying to create a particular class, or do you need the
class to be variable, or do you need the name of the class to be a
variable? E.g., you can just say:
new TestClass();
Or:
var theclass = TestClass;
...
new theclass();
Or:
var theclassname = "TextClass";
...
new global[theclassname]();
All of these work. Your mechanism is what is used to evaluate a
general expression, and is required because of the limited nature of
eval in the swf runtime. It is basically calling back to the server,
having the server compile the expression, and then loading the
compiled code to evaluate it.
In the DHTML runtime, eval is fully-featured, but remember it is a
security hole. If you allow arbitrary user input to be evalled, you
really have no control...
On 2007-10-12, at 14:12 EDT, Ruben Reusser wrote:
Hi:
Is it possible to create a class by name in OpenLaszlo? I tried:
eval("new TestClass()");
but this does not work. The only solution I could find was the
following:
loader.request( { lz_load : false,lzt : "eval",proxied: true,url:
"__debugger.lzx",lz_script : "#file interactive-eval-0\nnew
TestClass()"} );
not my favorite approach.
Ruben