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;
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.
I solved the issue by getting rid of the creationCompleteHandler event handlers for the KPI charts. But, since I am just days into flex development, I would be indebted if someone could explain to me why that was creating problems.