- 浏览: 67099 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
zhoujunying:
谢谢!!
flex 15秒超时 -
hiphunter921:
你settimeout写的对么?setTimeout(show ...
flex 15秒超时 -
zhoujunying:
为什么我的用settimeout还是会出现超时现象!!!
fu ...
flex 15秒超时 -
hiphunter921:
我所谓的是html里面的object标签,flash就是一个o ...
FABridge.js中的一个小问题 -
fhuan123:
您好,我也遇上了FABridge.bridgeName.roo ...
FABridge.js中的一个小问题
下载了wing酱的新浪微博AIR版,突然对Adobe AIR 产生了兴趣,刚巧遇上国内某聊天软件与某杀毒软件闹矛盾,本来就对这些软件没有好感的我就萌生一个念头,用AIR写个小小聊天工具,嘿嘿,我就立马想到了以前在RIA中使用过的BlazeDS RemoteObject,听说有个message service,所以来试试吧。
At the beginning, i tried to use the lastest version of sdk, so i download the Flex SDK 4.1(build 16076) and setup it successfully.
However, when I tried to run my AIR application, I ran into this error:
VerifyError: Error #1014: Class IIMEClient could not be found.
After doing a bit of research I found out that my Adobe AIR project’s application descriptor file wasn’t using the correct namespace for the AIR 2.0 SDK. According to the Adobe AIR 2 Release Notes:
I made the change in the descriptor file, and now everything works perfectly.
Flex code as follow:
<s:Producer id="producer"/>
<s:Consumer id="consumer"/>
import mx.messaging.ChannelSet; import mx.messaging.channels.AMFChannel; import mx.messaging.events.MessageEvent; import mx.messaging.messages.AsyncMessage; private function init():void{ consumer= new Consumer(); consumer.destination = "chat"; var channel:AMFChannel=new AMFChannel("my-long-polling-amf","http://192.168.2.80:8080/TestFlex/spring/messagebroker/amflongpolling"); var channelSet:ChannelSet = new ChannelSet(); channelSet.addChannel(channel); consumer.channelSet=channelSet; consumer.addEventListener(MessageEvent.MESSAGE, function(event:MessageEvent):void{ chatText.text += event.message.body.chatMessage + "\n"; }); consumer.subscribe(); producer.destination="chat"; producer.channelSet= channelSet; } protected function button1_clickHandler(event:MouseEvent):void{ var message:AsyncMessage = new AsyncMessage(); message.body.chatMessage = inputChat.text; producer.send(message); inputChat.text = ""; }
The server side configuration:
In order to use long polling amf channel , I added some config into the service-config.xml:
<channel-definition id="my-long-polling-amf" class="mx.messaging.channels.AMFChannel"> <endpoint url="http://{server.name}:{server.port}/{context.root}/spring/messagebroker/amflongpolling" class="flex.messaging.endpoints.AMFEndpoint"></endpoint> <properties> <polling-enabled>true</polling-enabled> <wait-interval-millis>-1</wait-interval-millis> <polling-interval-millis>100</polling-interval-millis> <max-waiting-poll-requests>50</max-waiting-poll-requests> </properties> </channel-definition>
- wait-interval-millis dictates how long the server should wait before returning a polling request. The default is 0. By setting it to -1, we are telling it to wait indefinitely until a message is to be routed to the client.
- polling-interval-millis is the time interval between polling requests. Since we no longer need to pace the requests, we could safely set the interval to 0.
- max-waiting-poll-requests caps the number of long polling clients. Since the server is not ackowleging right away during long polling, each client hogs one server thread. Once the cap is reached, any new clients fall back to simple polling clients.
We can see the specification of BlazeDS channel and endpoint from here .
I use the spring flex integration framework to my app. So i add some code to the applicationContext_flex.xml:
<flex:message-broker> <flex:message-service default-channels="my-streaming-amf,my-long-polling-amf,my-polling-amf" /> </flex:message-broker> <flex:message-destination id="chat" />
I defined a message destination named 'chat', hence the client side can use the name as the destination name.
tip:
- In the AIR app, we also need to set a Flex Server to it for using blazeds.
- To use a producer or a consumer , we need to set its channel.
In the RIA, i used to code like this:
var channelSet:ChannelSet = new ChannelSet(["my-long-polling-amf"]);
But in the AIR, there are some difference. It need giving fully qualified url's including the port for the destination, and using addChannel function instead of just using the ChannelSet constructor:
var channel:AMFChannel=new AMFChannel("my-long-polling-amf","http://192.168.2.80:8080/TestFlex/spring/messagebroker/amflongpolling");
var channelSet:ChannelSet = new ChannelSet();
channelSet.addChannel(channel);
发表评论
-
关于RSL的一段翻译
2011-12-13 21:28 1112为了找出可以从代码 ... -
ie中打开flash莫名其妙js报错,qq登陆后不停报错重启 解决方案
2011-02-24 15:31 3234ie中报错:__flash__addCallback(inst ... -
«Flex3宝典»读书笔记(2)
2010-11-14 14:34 018 使用高级列表控件 18.1.1 使用可编辑的Combo ... -
AS3技巧与提示1-8
2010-11-03 16:28 01. 改变影片的帧频 在 ... -
AS3技巧与提示38-44
2010-11-03 16:27 038.is 运算符(对比instanceof) AS3新 ... -
AS3技巧与提示33-37
2010-11-03 16:26 033.将事件处理器作为普通函数调用 AS3中我们定义事件 ... -
AS3技巧与提示29-32
2010-11-03 16:25 029.判断实例所属类及其 ... -
AS3技巧提示14-18
2010-11-03 16:24 014.SimpleButton类 AS3新增一个Simp ... -
AS3技巧提示9-13
2010-11-03 16:23 09.类型转换和as运算符 在必要的时候,AS充许把对象的 ... -
AS3技巧与提示45-48
2010-11-03 16:20 045.无用单元回收:引用计 ... -
AS3技巧提示19-22
2010-11-03 16:18 019.抽象类 AS3仍然不支持抽象类(不能示例化,只是用 ... -
AS3技巧与提示52-60
2010-11-03 16:16 052 用…(rest) 来表示不确定个数的Arguments变 ... -
AS3技巧与提示23-28
2010-11-03 16:13 023.新的深度排序方法 AS3中运用显示列表(displ ... -
AS3技巧与提示49-51
2010-11-03 16:11 049.getBounds()和getRect()对比 ... -
Flex中的Vector
2010-11-03 15:50 3719今天在一个concrete example 中看到了:var ... -
«Flex3宝典»读书笔记(1)
2010-10-30 10:38 0写flex也近一年了,从没 ... -
flex 15秒超时
2010-10-20 15:19 3563在flex中可以通过ExternalInterface调用js ... -
对于datagrid中删除后,对selectedIndex赋值后的问题
2010-07-06 19:30 1726对于datagrid中删除后,想要自动选中下一条记录,如果是最 ... -
FABridge.js中的一个小问题
2010-05-25 14:44 2307今天在尝试使用FABridge来连接flex与js时候,按照一 ... -
JAVA和FLEX整合(blazeds部署过程)
2010-02-10 14:33 2825刚开始时候尝试成功了 ...
相关推荐
NULL 博文链接:https://shihuan830619.iteye.com/blog/1053917
这是一份日文资料,但由于是PPT文件,看图即可学到如何配置...難しいことは置いといて、取り合えず 「BlazeDS」 を使って、Flash、AIRアプリから Javaオブジェクトのメソッドを呼び出すための手順書(Windows版)
BlazeDS是Adobe公司发布的免费开源产品,是该公司另一个收费产品LCDS的简化开源版本,BlazeDS使用Java语言在服务端提供如下功能: 1、提供客户端(Flex、AIR)通过AMF协议访问服务端(Java)数据的功能; 2、...
BlazeDS 是由 Adobe 公司免费发布,基于 Java 远程对象和 Web 消息服务, 面向 Adobe Flex 客户端和 AIR (Adobe Integrated Runtime) RIA (Rich Internet Application)进行数据处理和发布的服务器端技术。本...
BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe® Flex® and Adobe AIR...
AIR工程實例搭建步驟詳解 1 开发环境 413 2. 系統架構圖 414 3 服務端開發 414 3.1 數據庫訪問配置 415 3.2 SPRING配置 415 3.3 IBATIS配置 418 3.4集成 BLAZEDS 419 3.4.1 定义接口 419 3.4.2 定義實現類 420 ...
使用AIR/Flex/Action Script語言
Flex 是一个高效、免费的开源框架,可用于构建具有表现力的 Web应用程序,这些应用程序利用Adobe Flash Player和Adobe AIR, 运行时跨浏览器、桌面和操作系统实现一致的部署。虽然只能使用 Flex 框架构建 Flex应用...
《用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考》包含 ActionScript 语言元素、核心库、组件包以及适用于 Flash Platform 中的工具、运行时、服务和服务器的类。 使用预设过滤器按产品进行过滤 此...
5. BlazeDS remoting and logging 6. Flex messenging Part 3: Going above and beyond 7. Securing and personalizing your application 8. Charting with DeGrafa 9. Desktop 2.0 with Adobe AIR 10. ...
5. BlazeDS remoting and logging 6. Flex messenging Part 3: Going above and beyond 7. Securing and personalizing your application 8. Charting with DeGrafa 9. Desktop 2.0 with Adobe AIR 10. ...
Develop a sample AIR application that automatically synchronizes local and remote databases to support your sales force Get solutions for leveraging AMF protocol and synchronizing Flex client data ...
Who this book is for Every web developer interested... Most of the discussion hovers around BlazeDS, its alternatives and its possible extensions. Streaming is also touched upon. Chapter 8: PHP and Flex ...
Flex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdfFlex体系架构剖析_QCon.pdf