The .length of an array is always one grater than the last element
because arrays are zero based.  Try:

var ob:Object = arr[ln-1];  //returns the last element in the array

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of grimmwerks
Sent: Wednesday, October 22, 2008 7:39 PM
To: flexcoders@yahoogroups.com
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);

                        }

 

 

 

 

Reply via email to