PDA

View Full Version : NetConnection.call


brnwdrng
08-01-2003, 04:47 PM
I can't seem to get this function to work; perhaps I've misunderstood how it is used. I simply want to call a function residing on an aspx page from my a flash SWF on the same page.

My flash movie resides on webroot/flashremoting/bw/parentPage.aspx, and contains:



// my flash app "test.swf" sitting on parentPage.aspx
#include "NetServices.as"

var msg = "hello";

if (inited == null) {
inited = true;
NetServices.setDefaultGatewayUrl("http://localhost/flashremoting/gateway.aspx");
gatewayConnection = NetServices.createGatewayConnection();
objConnection = gatewayConnection.getService("flashremoting.bw", this);
}

function button_Clicked(){
objConnection.parentPage();
objConnection.call("parentPage.displayAlert", null, msg);
}


... and flashremoting/bw/parentPage.aspx contains:

<%@ Page language="C#" ContentType="text/html" %>
<%@ Register TagPrefix="MM" Namespace="FlashGateway" Assembly="flashgateway" %>

<script language="C#" runat="server">

void Page_Load(Object source, EventArgs e)
{
Flash.Result = "This is a test.";
displayAlert("initial value");
}

public void displayAlert(String message)
{
alert.Text = message;
}

</script>

<MM:Flash ID="Flash" runat="server" />

<html><head><title>test</title></head><body>
<object>..."test.swf" typical flash applet embed code here...</object>
<br />
<asp:label ID="alert" runat="server" />
</body></html>

I've left out the _Result and _Status functions in the AS above; the result of "This is a test" is successfully returned to a text field in my flash object, but my call to displayAlert() fails to work and change the alert label from "initial value" to "hello".

:confused: