我正在制作Air应用程序,我希望它能够接收用户输入的数据,例如用户填写文本字段,然后将它们发送给开发人员的应用程序。 我不是要求代码,我只是想方设法做到这一点。 谢谢
答案 0 :(得分:2)
这是一个有用的链接,指向Adobe的一周视频中的Flex:
Flex in a Week, Day3。请参阅“发送远程数据”部分。
如果你有空余时间,我建议你应该看整个系列。它将帮助您了解有关flex的更多信息。
更多信息。
此训练使用的一种方法是 HTTPService。
在<fx:Declarations>
块内创建一个新的HTTPService
,如下所示:
<fx:Declarations>
<s:HTTPService id="sendToServerService"
url=" YOUR_SERVER_URL_HERE "
method="POST"/>
<fx:Declarations>
注意:使用HTTPService类,您可以与PHP页面,ColdFusion页面,JavaServer Pages(JSP),Java servlet,Ruby on Rails和Microsoft Active Server Pages(ASP)进行通信。
使用ColdFusion的服务器网址示例为http://www.example.com/remoteData/addUserDatat.cfm
。
在 Script 块中创建一个从输入中获取数据的函数:
protected function onSendBtn(event:MouseEvent):void
{
var data:String = textInput1.text;
vehicleService.send(data);
}
在您的应用程序文件中,创建一个按钮和一个textInput控件:
<s:Button id="sendBtn" label="Send" click="onSendBtn(event)"/>
<s:TextInput id="textInput1"/>