Flex AMFPHP and VO’s (RemoteObjectAMF0 update)

July 25th, 2006 中文

Thanks to the help of some people on the Flex coders list, I have been able to update the RemoteObjectAMF0 class with some examples of how to use AMFPHP and PHP/AS VO’s. I got this to work with PHP 5.1.1 and PHP 4.3.11.

There was a few things that I learned how to do in the process. First was in Flex and AS3 you can define the object type of an ArrayCollection by using [ArrayElementType("com.renaun.samples.vo.BookVO")].

[code lang="javascript"]
[ArrayElementType("com.renaun.samples.vo.BookVO")]
public var books:ArrayCollection;
[/code]

To make the BookVO.php work in PHP 4 just change the “public” identifiers to “var”.

There are now 2 examples in the RemoteObjectAMF0 package. The first is the updated Cairngorm login example (see in action / source).

The new example I created is a non-Cairngorm AMFPHP example (see in action / source ).

Also note that I have changed the namespace to be “com.renaun.” instead of “com.multispan.”.

Thanks to Robert Was for providing me partial code.

[update]
The registering of the remote class in AS was not done properly. I need to use [RemoteClass(alias="com.renaun.samples.vo.BookVO")] not the old registerClass method. Thanks to Andrea for that tip.

The code examples have been updated so when you click on an item in the datagrid it display the name in a label field. This demonstrates the class mapping working.

Entry Filed under: Adobe Flex, Flex,AMF,PHP, Rich Internet Applications

11 Comments Add your own

  • 1. Simon Barber  |  2006-07-25 at 7.55 am

    Thats awesome Renaun. My next challenge is to try and get Class Mappings to work with CakePHP.

  • 2. diamondtearz  |  2006-07-25 at 9.09 pm

    Thank you for that. I was able to get some results back from my server with it and extend it to add an image for each book. That’s the first time I clearly understood the nature of the server-side value objects in AMFPHP.

  • 3. Renaun Erickson  |  2006-07-25 at 9.10 pm

    Simon, do you have some sample code I can play with in CakePHP to help with?

    Diamond, Glad to here it help.

  • 4. Renaun Erickson&hellip  |  2006-07-26 at 11.59 pm

    RemoteObjectAMFO update to latest Cairngorm

    The RemoteObjectAMF0 class and sample code have been updated to reflect the latest Cairngorm package. You can find Cairngorm for Flex2 on the labs.adobe.com site. I will not be packaging Cairngorm with my RemoteObjectAMF0 samples any more.
    There ar…

  • 5. Marcelo Serpa  |  2006-08-13 at 6.54 am

    Awesome work Renaun.

    @Simon: I´m also trying to do that… currently I´m still experimenting. Get to #cakeamfphp when you´ve got the time!

    Cheers,

    Marcelo.

  • 6. Fabian  |  2007-04-01 at 9.32 am

    the sample doesnt work :-(

    You are using your API Service in the services.mxml

  • 7. Renaun Erickson  |  2007-04-01 at 9.43 pm

    The “Services.mxml” has “http://localhost/amfphp1_2/gateway.php” defined, you need to replace it with your own gateway location. Is there something more specific that has an issue?

  • 8. Dan Van Brunt  |  2008-05-27 at 8.30 am

    Does your RemoteObjectAMF0 work with Flex 3?
    I’m getting the error:
    “VerifyError: Error #1053: Illegal override of RemoteObjectAMF0 in com.renaun.rpc.RemoteObjectAMF0.

    param count mismatch
    virt params=3 optional=1 mx.rpc::AbstractService/setCredentials()
    over params=2 optional=0 mx.rpc::AbstractService/setCredentials()

    When I look in the language ref for flex 2 and flex 3 I noticed that the AbstractService class has a different number of parameters for 2 vs 3.

    What are my options here?

  • 9. Renaun Erickson  |  2008-05-27 at 11.44 am

    Change the setCredential method code to the following in RemoteObjectAMF0.as

    override public function setCredentials( username:String, password:String, charset:String = null ):void
    {
    gateway_conn.setCredentials( username, password, charset );
    }

  • 10. Flex with PHP « It&&hellip  |  2008-10-13 at 9.47 pm

    [...] Renaun Erickson :: Flex AMFPHP and VO’s (RemoteObjectAMF0 update) [...]

  • 11. Fx-PHP « Flex Gener&hellip  |  2008-10-14 at 1.24 am

    [...] Renaun Erickson :: Flex AMFPHP and VO’s (RemoteObjectAMF0 update) [...]

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Disclaimer: I work as a Flash/Flex Developer for Adobe Systems Incorporated. The opinions expressed here represent my own and not those of my employer.

My Amazon.com Wish List

Calendar

July 2006
S M T W T F S
« Jun   Aug »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Most Recent Posts


Flex.org - The Directory for Flex