2008-01-16
Remoting by NetConnection
关键字: remoting netconnection一般在使用Flash Remoting功能的時候
都是安裝Remoting Library AS1、AS2 Component來用
其實是可以直接用NetConnection呼叫Remoting的
因為AMF在Flash Player中的Serialize、Deserialize動作
都是透過NetConnection於底層完成,並非寫在AS
就是因為寫在底層,所以AMF會比其他格式來得更有效率
NetConnection具有兩種連線方式,決定於要連線URL通訊協定
對FlashCom RTMP連線是像Socket持續性即時連線
對Remoting Server HTTP則是非持續性連線
不過兩者都是以AMF格式作序列化
以下示範用NetConnection呼叫Remoting方式:
ActionScript Code:
- var nc:NetConnection = new NetConnection();
- var url:String = "http://192.168.0.10:8084/FlashRemoting/gateway";
- nc.onResult = function(data) {
- trace("onResult : "+data);
- };
- nc.onStatus = function(info) {
- trace("onStatus : "+info);
- for (var i in info) {
- trace("info["+i+"] : "+info[i]);
- }
- };
- nc.connect(url);
- nc.call("swl.NewClass.Test", nc, 11);
- //output: onResult : Test() with Number : 11.0
Java Class Code:
- package swl;
- public class NewClass {
- public NewClass() {
- }
- public java.util.Map Test(java.util.Map map) {
- return map;
- }
- public String Test(java.util.ArrayList arraylist) {
- return "Test() with ArrayList : " + arraylist;
- }
- public String Test(String str) {
- return "Test() with String : " + str;
- }
- public String Test(String[] str) {
- return "Test() with String Array : " + str;
- }
- public String Test(Number num) {
- return "Test() with Number : " + num;
- }
- public String Test(boolean bo) {
- return "Test() with boolean : " + bo;
- }
- public String Test() {
- return "Test() no arguments";
- }
- }
此文收藏自Ticore‘s Blog: http://ticore.blogspot.com/2005/09/remoting-by-netconnection.html
- 15:43
- 浏览 (142)
- 评论 (0)
- 分类: Flash&JAVA
- 相关推荐
发表评论
- 浏览: 94582 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
我的相册
wenson
共 1 张
共 1 张
最新评论
-
我们是白领吗?
这是什么标准?个人净得?那可就不低了。
-- by fight_bird -
我们是白领吗?
郑州?五档 NO.1?
-- by Jerry . \ -
我们是白领吗?
老家有这么高的工资??? 我sun... 谁调查的??
-- by lordhong -
我们是白领吗?
应该更新了 使用了假新闻
-- by careprad -
java字符串转换器
有没有探测文字或文件编码的呢?
-- by spiritfrog






评论排行榜