Flex — C++ connection?

こ雲淡風輕ζ 提交于 2019-12-11 07:15:11

问题


How do I connect a Flex Application( Internet Site ) and C++ togehter ?

a minimalistic example from what i mean (User Story): Frank goes to www.myflexsite.de there are 2 textboxes and 1 Button( Label = add two numbers) . He inserts 2 in the first textbox and 5 in the ohter. Now he clicks on the add button.

The Backend : We have a add.cpp file where an add method is defined :

int add(int a, int b ) ...

After Frank clicked on the "add two numbers" Button the add-method in the C++ file is called and the result will be returned.An Alert Window with the result appears.

This is what i want to accomplish, but i don't know how i build the bridge between these 2 Languages. How can they communicate ?


回答1:


The easiest would be to write a small console application in C++ and then invoke it via Apache or any other web server using CGI. There are performance problems with this but it's a good start, and then you can move forward. From Flex just make HTTP requests and let your program parse them - for instance, you can send XML back and forth.




回答2:


I don't think this is necessarily the intent, but depending on what you want to accomplish you may want to take a look at the Alchemy project - http://labs.adobe.com/technologies/alchemy/ you can use it to compile C++ code down into code that runs on the Flash Player.

This won't help you communicate between a client and a server, but if there is code you don't want to have to completely rewrite that might be more helpful exposed directly in Flash, this could be a solution.

=Ryan ryan@adobe.com




回答3:


I was going to write a 'Restful' example, but a quick Bing search finds this guy has already done it:

Yahoo! Image Search REST API - Flex example

Just write your own server side web api in whatever language floats your boat.

ETA: question 153420 might be helpful also.



来源:https://stackoverflow.com/questions/2120082/flex-c-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!