And if you think zero-based array indexing is crazy, consider Edsger Dijkstra's short essay in favor of it:
http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com On Thu, 2008-10-23 at 00:50 +0100, Paul Andrews wrote: > var ob:Object = arr[Number(ln)] should be var ob:Object = arr[ln-1] > > You don't need to cast the ln variable and arrays are indexed from 0 > so the last value is at length -1. > > paul > ----- Original Message ----- > From: grimmwerks > To: flexcoders@yahoogroups.com > Sent: Thursday, October 23, 2008 12:38 AM > Subject: [flexcoders] ARGH shared object array -- getting data > > > This is driving me nuts -- an onSync of a shared object where > 'history' is an array -- I can the listing of the array, and > I get the length of the arraly, but I can't get each object in > the array -- what am I doing wrong?!?? > > > > > private function chatSync(event:SyncEvent):void{ > var arr:Array = new Array(); > arr = so_Chat.data.history; > Alert.show('array ' + arr); > var ln:Number = arr.length; > Alert.show("length: " + ln); > var ob:Object = arr[Number(ln)]; > Alert.show(ob.message); > Alert.show('message ' + arr[ln].message); > } > > > > > > > > >