RE: [flexcoders] E4X Interpreter
Not trying to hijack here but , how did you get a xml chain to bind? An yes a need for e4x features would be most handy, but until i get just a simple chain working can help ya ;) I'm trying to do this and getting no results at all? Dynamic binding not working, from the docs it say's Works fora property etc.. "call the method as: watch(host, ["a","b","c"], ...). " When binding to a chain. Go figure? as below mx:Script![CDATA[import mx.binding.utils.*;[Bindable]public var boundtarget:XML;private function Init_TargetBinding():void{boundtarget = new XML(itemfullnametesting/fullnametototest2/toto/item);var owatch:ChangeWatcher = BindingUtils.bindProperty(text1, "text",this , ["boundtarget","item","fullname"]);trace("Watched: " + owatch.isWatching());}]]/mx:Scriptmx:TextInput click="Init_TargetBinding();" id="text1"/ If my array only containes boundtarget then i get the xml. Jason -Message d'origine-De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]De la part de FineLineEnvoy: mercredi 21 juin 2006 03:26: flexcoders@yahoogroups.comObjet: [flexcoders] E4X Interpreter 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: Objects and Dynamic classes. These allow you to assign functions to an object or class at runtime, but only functions that are already defined within the source code. Theres no way to create new function from string. Same reasoning as eval() I guess. Event handlers for GUI objects. I found it is not possible to assign to or access the click property of a button, for example. Again, security reason I guess. Bindings. I have tried various ways of assigning the binding of a result field at runtime, the most successful being the BindingUtils.bindProperty method. This works with simple values and XML chains, but not with chains containing E4X features such as searching, as in the following example: 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 Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [flexcoders] E4X Interpreter
WishingI read my own writing.. I mean, I can't help you until I get mine working, and yes full e4x features would be great. Sorry bout that. jason -Message d'origine-De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]De la part de Jason HawrylukEnvoy: mercredi 21 juin 2006 12:20: flexcoders@yahoogroups.comObjet: RE: [flexcoders] E4X Interpreter Not trying to hijack here but , how did you get a xml chain to bind? An yes a need for e4x features would be most handy, but until i get just a simple chain working can help ya ;) I'm trying to do this and getting no results at all? Dynamic binding not working, from the docs it say's Works fora property etc.. "call the method as: watch(host, ["a","b","c"], ...). " When binding to a chain. Go figure? as below mx:Script![CDATA[import mx.binding.utils.*;[Bindable]public var boundtarget:XML;private function Init_TargetBinding():void{boundtarget = new XML(itemfullnametesting/fullnametototest2/toto/item);var owatch:ChangeWatcher = BindingUtils.bindProperty(text1, "text",this , ["boundtarget","item","fullname"]);trace("Watched: " + owatch.isWatching());}]]/mx:Scriptmx:TextInput click="Init_TargetBinding();" id="text1"/ If my array only containes boundtarget then i get the xml. Jason -Message d'origine-De: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]De la part de FineLineEnvoy: mercredi 21 juin 2006 03:26: flexcoders@yahoogroups.comObjet: [flexcoders] E4X Interpreter 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: Objects and Dynamic classes. These allow you to assign functions to an object or class at runtime, but only functions that are already defined within the source code. Theres no way to create new function from string. Same reasoning as eval() I guess. Event handlers for GUI objects. I found it is not possible to assign to or access the click property of a button, for example. Again, security reason I guess. Bindings. I have tried various ways of assigning the binding of a result field at runtime, the most successful being the BindingUtils.bindProperty method. This works with simple values and XML chains, but not with chains containing E4X features such as searching, as in the following example: 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 Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [flexcoders] E4X Interpreter
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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of FineLine Sent: Tuesday, June 20, 2006 6:26 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] E4X Interpreter 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: Objects and Dynamic classes. These allow you to assign functions to an object or class at runtime, but only functions that are already defined within the source code. Theres no way to create new function from string. Same reasoning as eval() I guess. Event handlers for GUI objects. I found it is not possible to assign to or access the click property of a button, for example. Again, security reason I guess. Bindings. I have tried various ways of assigning the binding of a result field at runtime, the most successful being the BindingUtils.bindProperty method. This works with simple values and XML chains, but not with chains containing E4X features such as searching, as in the following example: 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 Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___