5 Replies Latest reply on Feb 21, 2009 9:06 PM by Gregory Lafrance

    How do I access xml data in the component file?

    cpthk Level 1
      I have a component file. It is a component under a DataGridColumn itemRenderer. Here is partial of my code:
      Main:
      <mx:DataGrid dataProvider="{xmlData.lastResult.account.data}">
      <mx:columns>
      <mx:DataGridColumn itemRenderer="checkedIndicator" />
      </mx:columns>
      </mx:DataGrid>

      Component:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;

      private var test:Number = data.number; // doesn't work
      private function pop():void {
      mx.controls.Alert.show(test.toString());
      }
      ]]>
      </mx:Script>
      <mx:Button click="pop()"/>
      <mx:TextInput text="{data.number}"/> //working
      </mx:Canvas>

      The variable data.number in MXML can access my XML under TextInput, but cannot be access in my actionscript code under pop() function. Why is that?