[flexcoders] First attemt at getting result back from AMFPHP - Why is it a Object

2007-11-08 Thread oneproofdk
I'm using AMFPHP 1.9B and have created a service called
inventory.getInventoryGroups - in the AMF service browser I see the
result just perfect. :
(mx.collections::ArrayCollection)#0
   filterFunction = (null)
   length = 5
   list = (mx.collections::ArrayList)#1
 length = 5
 source = (Array)#2
   [0] (Object)#3
 data = 1
 label = Moduler
   [1] (Object)#4
 data = 2
 label = Hylder
   [2] (Object)#5
 data = 3
 label = Skuffer
   [3] (Object)#6
 data = 4
 label = Hvidlakerede bakker
   [4] (Object)#7
 data = 5
 label = Andet
 uid = 42A87A93-37B2-1BCF-2D31-1E7CD7004C04
   sort = (null)
   source = (Array)#2

But when I try to use the result in Flex (I've modified the examples
from Adobe
http://www.adobe.com/devnet/flex/articles/flex2_amfphp.html, using a
RemotingConnection copied from the Adobe example.

The problem is, that I get an Object back from AMFPHP and I just cant
figure out how to use that ??

This is my AS snippet :
public var gateway : RemotingConnection;
 public function initApplication():void
 {
 gateway = new RemotingConnection( gwurl );
 gateway.call( inventory.getInventoryGroups, new
Responder(onResult, onFault));
 }
 public function onResult( result : Object ) : void
 {
 trace( result );
 selInventoryGroups.dataProvider = result as ArrayCollection;
 }
 public function onFault( fault : String ) : void
 {
 trace( fault );
 }

I'm trying to populate a simple ComboBox with the result ! What have I
done wrong  [:-/]  ?

BTW If I select result : ArrayCollection it returns an error Cant
convert Object to ArrayCollection

Thanks for your help,
Mark



Re: [flexcoders] First attemt at getting result back from AMFPHP - Why is it a Object

2007-11-08 Thread Muzak
Use ObjectUtil.toString() to see what type the result really is in the Console, 
my guess is it's an Array though.

import mx.utils.ObjectUtil;

public function onResult( result:Object ):void {
trace(ObjectUtil.toString(result));
selInventoryGroups.dataProvider = new ArrayCollection(result as Array);
}


- Original Message - 
From: oneproofdk [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, November 08, 2007 10:38 AM
Subject: [flexcoders] First attemt at getting result back from AMFPHP - Why is 
it a Object


I'm using AMFPHP 1.9B and have created a service called
inventory.getInventoryGroups - in the AMF service browser I see the
result just perfect. :

I'm trying to populate a simple ComboBox with the result ! What have I
done wrong  [:-/]  ?

BTW If I select result : ArrayCollection it returns an error Cant
convert Object to ArrayCollection

Thanks for your help,
Mark




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 


[flexcoders] First attemt at getting result back from AMFPHP - Why is it a Object

2007-11-08 Thread oneproofdk
Sorry if this is a double posting - but my first post never showed up ?

I am using AMFPHP 1.9B and have created a service
inventory.getInventoryGroups - when I test it in the AMF service
browser - it works fine and returns this result :
(mx.collections::ArrayCollection)#0
  filterFunction = (null)
  length = 5
  list = (mx.collections::ArrayList)#1
length = 5
source = (Array)#2
  [0] (Object)#3
data = 1
label = Moduler
  [1] (Object)#4
data = 2
label = Hylder
  [2] (Object)#5
data = 3
label = Skuffer
  [3] (Object)#6
data = 4
label = Hvidlakerede bakker
  [4] (Object)#7
data = 5
label = Andet
uid = 42A87A93-37B2-1BCF-2D31-1E7CD7004C04
  sort = (null)
  source = (Array)#2

In Flex I have been following the Adobe example
http://www.adobe.com/devnet/flex/articles/flex2_amfphp_03.html but
the result I keep getting back is not an array or arraycollection. (I
would have thought it was ArrayCollection, especially because that's
what is says in the ServiceBrowser)

Can one of you guys please help me out here ? Here's my AS code :
public var gateway : RemotingConnection;
public function initApplication():void
{
gateway = new RemotingConnection( gwurl );
gateway.call( inventory.getInventoryGroups, new
Responder(onResult, onFault));
}
public function onResult( result : Object ) : void
{
trace( result );
selInventoryGroups.dataProvider = result as 
ArrayCollection;
}
public function onFault( fault : String ) : void
{
trace( fault );
}

I'm tryng to use the result as a dataprovider for a combobox !

Thanks for any help you could give me.

Mark