1 Reply Latest reply on Feb 21, 2011 8:26 PM by citsym

    Cannot access a property or method of a null object reference Error

    citsym


      I have a flex app that is fetching data from a mysql db through a php driver class. I have two charts in two containers of a viewstack. When any coloumn in the first chart is clicked, i am making the viewstack display the chart in the second container.
      The clickevent for the first chart is something like this:

       

      var graph:AmGraph = event.graph as AmGraph;
      var dataItem:GraphDataItem = event.item as GraphDataItem;
      var cat:String=dataItem.category;

      viewstack1.selectedChild=nc2;
      //Alert.show(cat);


      ctxtActKPIChart.dataProvider=getPDPActKPIResult.lastResult;
      getPDPActKPIResult.token = getKPID.getPDPActKPI(cat, dt);

      I am using amCharts component. The first three lines just gives me the category name for the coloumn that was clicked.
      The problem I am facing is that the first time someone clicks on the chart items, a "Cannot access a property or method of a null object reference Error" occurs.
      However, this is not the case on subsequent clicks.

       

      Here's the full code in case you want to get a better idea of what I am talking about.