在Flash Remoting与.Net的结合中,要返回多个值给Flash,比如返回一个数组或结构体的数据,比较简单,主要代码如下:
Test.Aspx:
<%@ Page language="c#" debug="true" %>
<%@ Register TagPrefix="Macromedia" Namespace="FlashGateway" Assembly="flashgateway" %>
<Macromedia:Flash ID="Flash1" Runat="Server" />
<script language="C#" runat="server">
void Page_Load(Object sender,EventArgs e)
{
string[] arr = new string[3];
arr[0] = "A";
arr[1] = "B";
arr[2] = "C";
Flash1.Result = arr;
}
</script>
<%@ Register TagPrefix="Macromedia" Namespace="FlashGateway" Assembly="flashgateway" %>
<Macromedia:Flash ID="Flash1" Runat="Server" />
<script language="C#" runat="server">
void Page_Load(Object sender,EventArgs e)
{
string[] arr = new string[3];
arr[0] = "A";
arr[1] = "B";
arr[2] = "C";
Flash1.Result = arr;
}
</script>
Flash中接受结果的方法:
function sayGreeting_Result(evt:ResultEvent):Void {
if (evt.result != null) {
trace(evt.result[0]);
trace(evt.result[1]);
trace(evt.result[2]);
}
}
if (evt.result != null) {
trace(evt.result[0]);
trace(evt.result[1]);
trace(evt.result[2]);
}
}
其它略。