开发者

How to invoke a function in actionscript 3 from a web service?

I'm building a game in Flash using ActionScript3 and I have a C# web service which communicates with the flash instances. I want to do chat in my game. So, when use开发者_如何转开发r A sends a message to user B, the appropriate web service function is called. I want the web service function to invoke an event in user B, telling it that a new message was recieved. In order to do so, I guess that I need a constant connection to the web service or something, but how can I do that? Is there something ready on the web that I can user?

Thanks.


Your best bet for something like that is a socket connection to your server. It's quite easy to set up in Flash and I would assume the same for C#.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html

Just create a socket, point it at your server, and listen for the socketData event.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜