> I can understand that an open-ended eval()
function might be a security worry Yes, and there are also some other reasons why AS3
doesn't include eval() ... It would make the Player larger than we'd like,
because the Player would have to contain the AS3 compiler. And the compiler would have to be in C++ (the
language the player is written in) rather than in Java (the language that Flex
tools are written in), so we'd have to maintain two copies of the compiler. - Gordon From: Hi.
Yesterday, I set out on what I thought would be a quick task using Flex –
an E4X interpreter, where a user can view an XML document as source and tree,
type in E4X expressions, and see the result of the _expression_. Ultimately, I
wanted to be able to perform assignments and see the effect (if any) on the
XML. Nice little tool to help learn E4X syntax. As
it turns out, this is a lot more difficult than I thought. I was hoping there
would be some way of evaluating an E4X _expression_ held in a string. I have
found that there was an eval() function in previous versions of ActionScript,
but it has been dropped. I can understand that an open-ended eval() function
might be a security worry, but it seems a bit restrictive not being able to
evaluate E4X expressions held as a string. I have looked into these approaches:
BindingUtils.bindProperty(
txtField, "text", this,
["xdata","item","(@id=='3456')","description"]
); I
have had a look at the generated ActionScript after compiling a project with a
simple “curly braces” bind to the E4X _expression_, and can see that
functions have been created to watch for changes to the XML object, and then
recalculate the _expression_, see if it has changed and if so update the text
field (I think…) So
anyway, short of rewriting the entire E4X interpretation algorithms, or relying
on a new component being compiled dynamically at runtime, can anyone think of a
way to do this? Cheers,
Tim -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|