Use trace() to debug instead of Alert.  Using Alert can cause UI/focus
problems in some circumstances.

 

Also, have you tried using ChangeWatcher instead of bindProperty?  It
might be easier to debug, since you can verify if/when the handler is
called.  In the handler, directly assign the dataProvider property.

 

Using addItem() *should* cause the necessary events to be dispatched.

 

BTW, you are using an ArrayCollection, not an Array.  There is a
significant difference.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of netdeep
Sent: Thursday, November 20, 2008 1:42 PM
To: [email protected]
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?

 

Reply via email to