0 Replies Latest reply on Jul 25, 2006 5:09 AM by avanthika

    getting the Flex component name which is created in Javascript

    avanthika Level 1

      Hi,

      I am going through the following FABridge sample

      http://labs.adobe.com/wiki/index.php/Flex_Framework:FABridge

      in this Application, if we click on radio button we can create flex chart , datagrid so on.

      it is working fine.

      my problem is, for example when creating a chart component,

      if (code == "make_chart")
      {
      newCode =
      'var chart = FABridge.example.create("mx.charts.ColumnChart");\n' +

      'chart.setName("chart0");\n' +

      'var s1 = FABridge.example.create("mx.charts.series.ColumnSeries");\n'+
      's1.setYField("Projectcode");\n'+

      'var s2 = FABridge.example.create("mx.charts.series.ColumnSeries");\n'+
      's2.setYField("Timetaken");\n'+

      'chart.setSeries( [s1, s2] );\n'+
      'chart.setWidth(300);\n'+
      'chart.setHeight(200);\n\n'+

      'panel().addChild(chart);\n'+

      "";}



      the code is used to make a chart component , ok this is fine;

      I want , if i click on the chart i want to get its name.

      so to get this i have add a following eventListener to the above code.

      'chart.addEventListener("click", function(event) {trace( this.name) } );

      trace is function which displays the value in a text box.

      but i could not get any name, in make_chart , we are setting the name ( chart.setName("chart0"), How to retrieve that name.

      any one please help me how to get this.

      thanks
      Avanthika