if u want to listen a ArrayCollection when some of its elements are
changed. u could write like this:
dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,updateHandler);
private function updateHandler(event:CollectionEvent):void
{
}
look up CollectionEvent api , u can find out how to do next step.
________________________________
From: netdeep <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, November 21, 2008 2:41:48 AM
Subject: [flexcoders] appending to a dataprovider in actionscript
I am still trying to iron out the problems with data binding in actionscript an
server push. If I just replace the old
array with a new one, it updates ok, but when I append to an array, it doesn't
seem to work.
I have to do everything in actionscript. I set up the data binding like this.
BindingUtils. bindProperty( lineSeries, "dataProvider" , ser, "pointList") ;
Here is the way I'm currently trying to append the new data and catch the
error, but this does not work.
// oldArray is the same as pointlist from the data binding line of code above
for (var i:int = 0; i<newArray.length; i++) {
oldArray.addItem( newArray. getItemAt( i));
}
What's more, because the app is fired remotedly from a server process, I can't
trace or run it in debug mode to find
out why it's failing. Usually, I'll throw in an Alert.show to find out if the
data is messed up or a variable is null, but
when I do it after running this loop, the Alert just hangs the whole
application. Is there anyway to throw an error to
a popup box (flash seems to do this from time to time on its own)
And one final related question. If I do get the new arrays to work, will the
charts labels and range adjust
accordingly. In other words, if the original array was from Mon-Wed, if the
new data is on Thurs, will the chart auto
adjust properly to show the new data?