MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Use Manual page 154

Using flash remoting for flash mx 2004 actionscript 2.0
Table of Contents

Advertisement

To display the data from the previous ASPX page, as CustomerCountries.aspx under the
ADOExamples folder, in a DataGrid object called custCountry_grd, the ActionScript code would
look like this:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
var custCountryASPX:Service = new Service( "http://localhost/flashremoting/
gateway.aspx", null, "flashremoting.samples.ADOExamples", null, null );
var pc:PendingCall = custCountryASPX.CustomerCountries();
pc.responder = new RelayResponder( this, "gotCountries", "gotFault" );
function gotCountries( re:ResultEvent ):Void {
custCountry_grd.dataProvider = re.result; // got a RecordSet back in result
}
function gotFault( fe:FaultEvent ):Void {
trace( "error-"+fe.fault.faultstring );
}
The following Visual Basic .NET example shows the
code-behind file that performs the same operation as the previous code example:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'create a SQL connection object and open a connection
Dim source1 As String
source1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\inetpub\\wwwroot\\flashremoting\\Samples\\ado\\Northwind.mdb;"
sqlConnection = New OleDb.OleDbConnection()
sqlConnection.ConnectionString = source1
sqlConnection.Open()
'create the SQL statement
Dim selectAll As String
selectAll = "SELECT ContactName, City, Phone, Country FROM Customers"
'Initialize a DataSet contactData and string selectContactData
Dim contactData As New DataSet()
Dim selectContactData As String
'Check for parameters from Flash
If (Flash.Params.Count = 0) Then
'create the SQL statement
Dim selectCountry As String
selectContactData = "SELECT DISTINCT Country FROM Customers ORDER BY
Country ASC"
Else
Dim selectedCountryName As String
'assign parameter passed from Flash to variable
selectedCountryName = Flash.Params(0).ToString()
154
Chapter 8: Using Flash Remoting for Microsoft .NET
method definition in a
Page_Load

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?

This manual is also suitable for:

Flash remoting mx

Table of Contents