[flexcoders] simple arraycollection question
I have a .as class extending arraycollection. In the constructor I set up a webservice and listner to capture the result in resultHandler Ideally in resultHandler I'd do something like this=event.result; but it doesn't work, so I am looping over the event.result, adding it to the array collection like: this.addItem(event.result[i]); can I assign the whole array collection in one go. Probably missing something simple, but I just can't see it :( Thx
Re: [flexcoders] simple ArrayCollection question
I dont know the format that php uses for sending data, but in java when I send data, the result also has a field called source which is already in the form of an ArrayCollection. This I suspect depends on the data structure used to send the data and how php does it. Regards, Hank On 1/13/07, Kevin <[EMAIL PROTECTED]> wrote: I solved my own problem! I had forgotten to include the 'new' keyword...it's getting late in NYC! code should read: public function result(data:Object):void { var myList:ArrayCollection = new ArrayCollection(data as Array); } - Kevin On Jan 13, 2007, at 7:15 PM, Kevin wrote: I can't seem too create an ArrayCollection from and array. I have data being returned (type object) which I can successfully type into an array, but when I try to then change it to an ArrayCollection it fails with the follow error. What am I doing wrong? public function result(data:Object):void { var myList:ArrayCollection = ArrayCollection(data as Array); } ERROR: TypeError: Type Coercion failed: cannot convert [EMAIL PROTECTED] to mx.collections.ArrayCollection. this works fine, public function result(data:Object):void { var myList:Array = data as Array; } this is what is being sent to result() var sendList: Object = ['test 0','test 1','test 2','test 3','test 4','test 5','test 6']; responder.result( sendList ); . Thanks much, - Kevin
Re: [flexcoders] simple ArrayCollection question
I solved my own problem! I had forgotten to include the 'new' keyword...it's getting late in NYC! code should read: public function result(data:Object):void { var myList:ArrayCollection = new ArrayCollection(data as Array); } - Kevin On Jan 13, 2007, at 7:15 PM, Kevin wrote: I can't seem too create an ArrayCollection from and array. I have data being returned (type object) which I can successfully type into an array, but when I try to then change it to an ArrayCollection it fails with the follow error. What am I doing wrong? public function result(data:Object):void { var myList:ArrayCollection = ArrayCollection(data as Array); } ERROR: TypeError: Type Coercion failed: cannot convert [EMAIL PROTECTED] to mx.collections.ArrayCollection. this works fine, public function result(data:Object):void { var myList:Array = data as Array; } this is what is being sent to result() var sendList: Object = ['test 0','test 1','test 2','test 3','test 4','test 5','test 6']; responder.result( sendList ); . Thanks much, - Kevin
[flexcoders] simple ArrayCollection question
I can't seem too create an ArrayCollection from and array. I have data being returned (type object) which I can successfully type into an array, but when I try to then change it to an ArrayCollection it fails with the follow error. What am I doing wrong? public function result(data:Object):void { var myList:ArrayCollection = ArrayCollection(data as Array); } ERROR: TypeError: Type Coercion failed: cannot convert [EMAIL PROTECTED] to mx.collections.ArrayCollection. this works fine, public function result(data:Object):void { var myList:Array = data as Array; } this is what is being sent to result() var sendList: Object = ['test 0','test 1','test 2','test 3','test 4','test 5','test 6']; responder.result( sendList ); . Thanks much, - Kevin