Flex AMFPHP and VO’s (RemoteObjectAMF0 update)
[lang_en]
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;
[/cc]
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.
[/lang_en]
[lang_zh]
ç”±Flex Coders List的一些人, 我能够更新æ¢ä»£ Remote Object AMFO,ç»™å‡ ä¸ªæ€Žä¹ˆç”¨AMFPHPå’ŒPHP/AS
VO的例å。用PHP 5.1.1å’ŒPHP 4.3.11å¯ä»¥åšå¾—到。
在过程ä¸æˆ‘å¦åˆ°ä¸€äº›äº‹æƒ…。其一,
在Flex和AS3用[ArrayElementType("com.renaun.samples.vo.BookVO")]
ä½ èƒ½å®šä¹‰ArrayCollectionçš„object type。
[code lang="javascript"]
[ArrayElementType("com.renaun.samples.vo.BookVO")]
public var books:ArrayCollection;
[/cc]
为了在PHP 4用BookVO.phpä½ éœ€è¦æŠŠ"public"改到"var"。
现在Remote Object AMFO包有两个例å。第一个是更新æ¢ä»£çš„Cairngorm注册例å (例å/代ç 程åº)。
æˆ‘åˆšåˆ›é€ çš„æ˜¯ä¸€ç§non-Cairngorm AMFPHP的例å (例å/代ç 程åº)。
注æ„, 我改namespace到 "com.renaun."ä¸æ˜¯åŽŸæ¥çš„ "com.multispan."。
æ„Ÿè°¢Robert Was, 他给我代ç 程åºçš„一部分。
[æ›´æ–°æ¢ä»£]
.
AS Remote class的登录åšé”™äº†ã€‚必得用[RemoteClass(alias="com.renaun.samples.vo.BookVO")],
别用以å‰çš„registerClass的方法。感谢Andrea的注æ„。
我有更新æ¢ä»£ä»£ç 的例å, 所以按数æ®ç½‘项目的时候他会在label field把åå—表现出æ¥ã€‚
[/lang_zh]
Pingback: Renaun Erickson
Pingback: Flex with PHP « It’s all about RIA
Pingback: Fx-PHP « Flex Generation Weblog
Pingback: Quick Links for Technology :: Adobe Flex :: With PHP « Mjcprasad’s Blog