Expand my Community achievements bar.

TypeError#1009 Want to have a listener on a chart.

Avatar

Level 1
TypeError: Error #1009: It is not possible to get a zero
pointer object.



I want to have a listener on a chart. When I click on it, a
number appears in a box.

I marked the coding which makes the TypeError with X below.



I just wonder, it works in a small programm, but in mine not?
Somebody can tell why?

Thanks a lot!



Ezachiael







<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" width="668" height="600"
creationComplete="send_data()" alpha="1.0"
backgroundGradientAlphas="[1.0, 1.0]" cornerRadius="5"
backgroundGradientColors="[#FFFFFF, #FFFFFF]" borderColor="#FFFFFF"
>

<mx:Script>

<![CDATA[

import mx.charts.events.ChartEvent;

import mx.charts.events.ChartItemEvent;

private function send_data():void {

// blogday.send();

// blogweek.send();

blogmonth.send();

// proj1.send();

// intensity7.send();

// intensity1.send();

// intensity30.send();

X init2();







}

private function send_day():void {

columnchart1.dataProvider=blogday.lastResult.TAGE.DAYS.TAG;

dg.dataProvider=blogday.lastResult.TAGE.DAYS.TAG;

}

private function send_week():void {

columnchart1.dataProvider=blogweek.lastResult.TAGE.DAYS.TAG;

dg.dataProvider=blogweek.lastResult.TAGE.DAYS.TAG;

}



private function send_month():void {


columnchart1.dataProvider=blogmonth.lastResult.TAGE.DAYS.TAG;

dg.dataProvider=blogmonth.lastResult.TAGE.TAG;

}

private function proj_day():void {

pc2.dataProvider=proj1.lastResult.TAGE.DAYS.TAG;

}

private function int7():void {



lc.dataProvider=intensity7.lastResult.TAGE.DAYS;

lcca.dataProvider=intensity7.lastResult.TAGE.DAYS;

wb.dataProvider=intensity7.lastResult.TAGE.DAYS;

wbca.dataProvider=intensity7.lastResult.TAGE.DAYS;

}



private function int30():void {

lc.dataProvider=intensity30.lastResult.TAGE.DAYS;

lcca.dataProvider=intensity30.lastResult.TAGE.DAYS;

wb.dataProvider=intensity30.lastResult.TAGE.DAYS;

wbca.dataProvider=intensity30.lastResult.TAGE.DAYS;

}

private function int1():void {

lc.dataProvider=intensity1.lastResult.TAGE.DAYS;

lcca.dataProvider=intensity1.lastResult.TAGE.DAYS;

wb.dataProvider=intensity1.lastResult.TAGE.DAYS;

wbca.dataProvider=intensity1.lastResult.TAGE.DAYS;

}







// Define event listeners when the application initializes.

X public function init2():void {

X
columnchart1.addEventListener(ChartItemEvent.ITEM_DOUBLE_CLICK,
myListener);



}





// Define the event handler.

X public function myListener(e:ChartItemEvent):void {

X ti1.text = "Test";

}



]]>

...



X <mx:Form>

X <!--Define a form to display the event
information.-->

X <mx:FormItem label="Expenses:">

X <mx:TextInput id="ti1"/>

X </mx:FormItem>

X </mx:Form>



...
0 Replies