开发者

Whats the best practices to let flash files communicate with my website?

I am working on a website and this website contains games and this games will need to submit score to the website so the website will handle saving the user game score in the database.

So i am asking about the standards and common techniques to do this communications between the website and the flash games, is it better to let the flash files call javascript functions or call server side code? i have no idea how this can be done

Note: i can ask the flash games creator to edit the flash files to call some functions.

Al开发者_如何学Cso may be 'not sure yet' i will need to send from the server to the flash some variables.


It would be better for you if you create some javascript api that the game creators can hook into. Then it is entirely up to you what you do with it: ajax calls to webservices springs to mind.

This would protect you from having to learn Flex or Action script and if you can get the agreement of the game developers on the api, then you have abstracted this interface and your implementation in the browser will be de-coupled from what happens in Flash.


Well, the way I'm used to it, is that firstly, you design an API for the service the game developers should use. Obviously, you have to actually implement the service. :)

The next step is to provide an SDK, that further encapsulates the API and makes working with it easy, bridging the semantic gap between the API and the client, and sparing the developers the dull work of marshalling calls and parsing return values.

You can provide the SDK for use as a runtime shared library, so that you can provide bug-fixes and other interal changes without requiring recompiles and updates.

The reason, why I cannot really agree with Daniel is, that I don't really see a benefit in introducing an intermediary layer. It is just one more source of errors and security issues. From my experience, the most dramatical changes I know to APIs is deprecation of calls, change of call signatures or structure of returned data. Since you're writing this from scratch, it is very likely to happen.

In conclusion, the best practices for me are:

  • a well designed API
  • documentation
  • an SDK
  • developer support

greetz
back2dos

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜