Flex using XML dot notation string -


in following example first trace gives me xml data @ node, second trace not. as3. how use variable same inline dot notation?

var x:string = "animxml.home.version"; trace(animxml.home.version);  // works trace([x]);                   // not 

thanks

not sure trying achieve output same thing:

var x:string = animxml.home.version string; trace(animxml.home.version);  // works trace(x);                     // works 

update (full script):

<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009"      xmlns:s="library://ns.adobe.com/flex/spark"      xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600">      <fx:declarations>         <fx:model id="animxml">             <root>                 <home>                     <version>version 1</version>                 </home>             </root>         </fx:model>         </fx:declarations>      <fx:script>         <![cdata[             protected function clickhandler(event:mouseevent):void             {                 var x:string = animxml.home.version string;                 trace(animxml.home.version);  // works                 trace(x);                     // works             }          ]]>     </fx:script>      <s:button label="test" click="clickhandler(event)" />  </s:application> 

click on "test" button gives following output:

version 1 version 1 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -