Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / September 2004



Tip: Looking for answers? Try searching our database.

Simple posting form Flash Remoting and AS2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jeffcg2 - 04 Sep 2004 00:37 GMT
I've spent the last week or so going thru Macromedia's FlashMX 2004
actionscript learning lots of cute things.
Still can't find any examples of how to do the simple tasks of INSERT, UPDATE,
DELETE. SELECT was fairly simple.
Of course there are examples for this.  
Here is a very simple form I would like to get working.

http://209.107.237.165/test/user.swf 

Anyone found any useful place to get help for what should be a simple task
like this.
jeffcg2 - 04 Sep 2004 13:58 GMT
I'm going to try to create this simple submit form. Maybe someone could jump in
and tell me what I am missing.

user.fla file with just 4 input text fields - name,state,zip,email and a
submit button

user.as file

Datasource MSSQL 2000 myTest

Table
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[auser]')
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[auser]
GO

CREATE TABLE [dbo].[auser] (
    [mytestid] [int] IDENTITY (1, 1) NOT NULL ,
    [name] [varchar] (50) NULL ,
    [email] [varchar] (50) NULL ,
    [state] [varchar] (50) NULL ,
    [zip] [varchar] (10) NULL
) ON [PRIMARY]
GO

Basic CF Component named user.cfc
<cfcomponent>
    <cfset datasource = "mytest" />
    <cffunction access="remote" name="post" output="true" returntype="query">
        <cfargument name="name" type="string" required="true">
        <cfargument name="state" type="string" required="true">
        <cfargument name="zip" type="string" required="true">
        <cfargument name="email" type="string" required="true">
        <cfset var rQuery ="" />
        <cfquery name="rQuery" datasource="#datasource#">
            insert into auser
            (name, state, zip, email)
            values
           
('#arguments.name#','#arguments.state#','#arguments.zip#','#arguments.email#')
        </cfquery>
        <cfquery datasource="#DATASOURCE#" name='rQuery'>
            Select @@identity AS newId
        </cfquery>
       
        <cfreturn rQuery>
    </cffunction>
</cfcomponent>
jeffcg2 - 04 Sep 2004 14:13 GMT
I think that if I put the user.fla file and the user.as file in the same
directory the user.fla file will be able to use the actionscript in the user.as
file. I also think that there is no need to put any actionscript in the
user.fla file.
Correct?

SO all I should have to do from this point is to build the user.as file?
jeffcg2 - 04 Sep 2004 14:30 GMT
If my thinking is correct to this point. I continue to build the user.as file.

Using the customerinfoexampleapi.as as a model I start with this to import all
the class files to the user.as file that I will need. For this exercise I'm not
going to need the List or ComboBox classes but what the heck I'll leave them in.
My understanding is that Flash only compiles into the user.swf file the class
files that are actually used. Correct?

user.as
___________
import mx.controls.TextInput;
import mx.controls.List;
import mx.controls.ComboBox;
import mx.controls.Button;

import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;

import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;

class user extends form
{
      stuff goes here
}
jeffcg2 - 04 Sep 2004 15:27 GMT
From here on I know I am dazzed and confused.
I need a check list of things necessary to hit the submit button and have
something happen.

ONE: I have to create a connection to my user.cfc component.

So I will need to create a function.
public function createConnection():
{
something here? I'll be trying to figure this one out for awhile.
}

sample function
____________________
public function createConnection():Void
    {
        var work_Orders = new Service(path, null,
"mx2004solution.services.workOrder", null, null );
        var pendingWorkOrders:PendingCall = work_Orders.getWorkOrders();
        pendingWorkOrders.responder = new RelayResponder( this, "filterWorkOrders",
"reportError" );
       
        var status_Code = new Service(path, null,
"mx2004solution.services.statusCode", null, null );
        var pendingstatusCode:PendingCall = status_Code.getStatusCodes();
        pendingstatusCode.responder = new RelayResponder( this, "fillComboBox",
"reportError" );
    }
jeffcg2 - 04 Sep 2004 19:12 GMT
What is going on here.
When I check the code on the sample CustomerInfoFormAPI.as file I get all
these errors?
The application works so what's up?

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 24:
The class 'mx.remoting.Service' could not be loaded.
             custService = new Service(

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 31:
The class 'mx.remoting.PendingCall' could not be loaded.
             var pc:PendingCall = custService.getCategories(); // get all categories

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 33:
The class 'mx.rpc.RelayResponder' could not be loaded.
             pc.responder = new RelayResponder( this, "onCategoryData",
"onCategoryDataFault" );

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 72:
The class 'mx.remoting.PendingCall' could not be loaded.
             var pc:PendingCall = custService.getCustomers(
custCat_cmbo.selectedItem.data );

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 73:
The class 'mx.rpc.RelayResponder' could not be loaded.
             pc.responder = new RelayResponder( this, "onCustomerData",
"onCustomerDataFault" );

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 88:
The class 'mx.rpc.ResultEvent' could not be loaded.
         function onCategoryData( re:ResultEvent ):Void {

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 97:
The class 'mx.rpc.ResultEvent' could not be loaded.
         function onCustomerData( re:ResultEvent ):Void {

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 99:
The class 'mx.remoting.RecordSet' could not be loaded.
             var rs:mx.remoting.RecordSet = mx.remoting.RecordSet( re.result );

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 109:
The class 'mx.rpc.FaultEvent' could not be loaded.
         function onCustomerDataFault( fault:FaultEvent ):Void {

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 117:
The class 'mx.rpc.FaultEvent' could not be loaded.
         function onCategoryDataFault( fault:FaultEvent ):Void {

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 123:
The class 'mx.remoting.Service' could not be loaded.
         private var custService:Service;

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 131:
The class 'mx.remoting.Service' could not be loaded.
     }

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 24:
There is no method with the name 'Service'.
             custService = new Service(

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 131:
The class 'mx.rpc.RelayResponder' could not be loaded.
     }

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 33:
There is no method with the name 'RelayResponder'.
             pc.responder = new RelayResponder( this, "onCategoryData",
"onCategoryDataFault" );

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 131:
The class 'mx.rpc.RelayResponder' could not be loaded.
     }

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 73:
There is no method with the name 'RelayResponder'.
             pc.responder = new RelayResponder( this, "onCustomerData",
"onCustomerDataFault" );

**Error**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 91:
There is no method with the name 'DataGlue'.
             DataGlue.bindFormatStrings( custCat_cmbo, re.result, "#Name#", "#ID#" );

**Warning**
C:\Inetpub\wwwroot\RemotingSamples\Client\API\CustomerInfoFormAPI.as: Line 99:
There is no class or package with the name 'mx.remoting.RecordSet' found in
package 'mx.remoting'.
             var rs:mx.remoting.RecordSet = mx.remoting.RecordSet( re.result );

Total ActionScript Errors: 19     Reported Errors: 19
jeffcg2 - 06 Sep 2004 15:45 GMT
I'm working with the sample and modifying it.

http://www.macromedia.com/devnet/mx/trio/articles/trio_widget2004_print.html

This works.

http://209.107.237.165/test/auser.swf

auser.fla has this code in frame one.
------------------
import ServiceOrders

/* replace this string with your default gateway*/
var path:String = "http://209.107.237.165/flashservices/gateway";

/* create a new instance of ServiceOrders and pass all the references of the
Components that we drag into the stage  */
var ServOrders:ServiceOrders = new ServiceOrders( path, statusCodes,
servOrdersList, license_txt, submit);

-------------

This is ServiceOrders.as

/**
   @class ServiceOrdersBeta  
   @author BlueInstant.com & mikekollen.com
*/
import mx.controls.TextInput;
import mx.controls.List;
import mx.controls.ComboBox;
import mx.controls.Button;

import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;

import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;

class ServiceOrders
{
    private var  cfConnection:NetConnection;
    private var  workOrders:RecordSet;
   
    /* Gui Componets*/
    private var  serviceOrders:List;
    private var  statusComboBox:ComboBox;
    private var  submit:Button;
    private var  license:TextInput;
    private var  path:String;
   
    function ServiceOrders(p:String, cb:ComboBox, lb:List, txt:TextInput,
btn:Button)
    {
        license = txt;
        statusComboBox = cb;
        serviceOrders = lb;
        submit = btn;
        path = p;
        init();
    }

    public function init():Void
    {
        /* listener for the TextInput*/
        license.addEventListener("change", this);
       
        /* listener for the ComboBox*/
        statusComboBox.addEventListener("change", this);
       
        /* listener for the Button*/
        submit.addEventListener("click", this);
       
        createConnection();
    }

    public function createConnection():Void
    {
        var work_Orders = new Service(path, null, "test.workOrder", null, null );
        var pendingWorkOrders:PendingCall = work_Orders.getWorkOrders();
        pendingWorkOrders.responder = new RelayResponder( this, "filterWorkOrders",
"reportError" );
       
        var status_Code = new Service(path, null, "test.statusCode", null, null );
        var pendingstatusCode:PendingCall = status_Code.getStatusCodes();
        pendingstatusCode.responder = new RelayResponder( this, "fillComboBox",
"reportError" );
    }
    public function fillComboBox(r:ResultEvent):Void
    {
        /* Populate the ComboBox with the returned recordSet uses
DataGlue.bindFormatString to re-map fields so that label equals STATUS_NAME
field and data equals STATUS_ID field */
        DataGlue.bindFormatStrings( statusComboBox, r.result,
                                    "#STATUS_NAME#",
                                    "#STATUS_ID#" );
    }
    public function reportError(myFault:FaultEvent):Void
    {
        trace("reportError: " + myFault.fault.faultstring);
    }
    public static function     FILTER_FUNCTION(record, obj ):Boolean
    {
        /*    make the license text the same length of the obj.text length to compare
them */
        var licenseText:String = record.LICENSE.substr( 0, obj.txt.length );
       
        /*    Return true if both texts and ids are equal or if texts are equal and id
is "All
        *    Active" (id = 1). Otherwise returns false */
        return (licenseText == obj.txt && ( record.STATUS_ID ==  obj.id || obj.id ==
1) )
    }
    public function filterWorkOrders(r:ResultEvent):Void
    {
        /* Keep a reference to the query returned casting to a recordset class*/
        if(r != undefined) workOrders = RecordSet(r.result);
       
        /* clean our List, removing all current items */
        serviceOrders.removeAll();
       
        /* this object will be passed to the filter function with two properties*/
        var filterParams:Object = {};
       
        /* get the text typed in the TextInput and convert it to upper case*/
        filterParams.txt = license.text.toUpperCase();
       
        /*    Get the selected item from the comboBox
        *    If this is undefined we assign the value 1, which corresponds to the ID of
"All
        *    Active"
        */
        filterParams.id = (statusComboBox.selectedItem.data != undefined) ?
statusComboBox.selectedItem.data : 1;
       
        /* apply the filter that returns a new RecordSet */
        var rec:RecordSet = workOrders.filter(FILTER_FUNCTION, filterParams);
       
        /* get the Iterator from this new filtered recordset and populate the List */
        var it = rec.getIterator();
        while( it.hasNext())
        {
            var record = it.next();
            serviceOrders.addItem(record.LICENSE + " ( " +record.STATUS_NAME + " )",
record.WORK_ORDER_ID );
        }
    }
   
    public function change():Void
    {
        /*Every time an item in the dropDown is selected or text is typed in the
TextInput,
        * this method is called because it has been registered as a listener of
those two components*/
        filterWorkOrders();
    }
    public function click():Void
    {    /* This method gets called whenever the submit button is released
        * because it has been registered as a listener of the button */
        openServiceManager();
    }
    public function openServiceManager():Void
    {
        getURL("serviceManager.cfm?workOrder=" + serviceOrders.selectedItem.data  +
"&license=" + license.text + "&status=" + statusComboBox.selectedItem.data);
    }
}
jeffcg2 - 06 Sep 2004 15:59 GMT
Continuing saga.

This does not work.

I get this error.
---------
**Error** C:\Inetpub\wwwroot\test\auser.as: Line 79: The class
'mx.rpc.RelayResponder' could not be loaded.
             pendingUser.responder = new RelayResponder(this, "work","nowork");

Total ActionScript Errors: 1     Reported Errors: 1

http://209.107.237.165/test/user.swf

user.fla has this code in frame one
--------------
import auser

/* replace this string with your default gateway*/
var path:String = "http://209.107.237.165/flashservices/gateway";

/* create a new instance of ServiceOrders and pass all the references of the
Components that we drag into the stage  */
//var ServOrders:ServiceOrders = new ServiceOrders( path, statusCodes,
servOrdersList, license_txt, submit);
var auser:auser = new auser( path, name_txt, state_txt, zip_txt, email_txt,
submit_btn);

auser.cfc
---------
<cfcomponent>
    <cfset datasource = "mytest" />
    <cffunction access="remote" name="post" output="true" returntype="boolean">
        <cfargument name="name" type="string" required="true">
        <cfargument name="address" type="string" required="no" default="">
        <cfargument name="city" type="string" required="no" default="">
        <cfargument name="state" type="string" required="no" default="">
        <cfargument name="zip" type="string" required="no" default="">
        <cfargument name="phone" type="string" required="no" default="">
        <cfargument name="email" type="string" required="no" default="">
        <cfset var rQuery ="" />
        <cfquery name="rQuery" datasource="#datasource#">
            insert into auser
            (name, state, zip, email)
            values
           
('#arguments.name#','#arguments.state#','#arguments.zip#','#arguments.email#')
        </cfquery>
        <cfreturn true>
    </cffunction>
    <cffunction access="remote" name="getUsers" output="true" returntype="query">
        <cfquery name="qryUsers" datasource="#datasource#">
            select name, state, zip, email
            from auser
        </cfquery>
        <cfreturn qryUsers>
    </cffunction>
    <!---<cfset DATASOURCENAME = "Notes" />

   
        Adds a note.
    --->
    <!--- <cffunction name="addNote" access="remote" returntype="struct">
        <cfargument name="note" type="string" required="true">
        <cfargument name="title" type="string" required="true">
       
        <cfset var rQuery = "" />
           
        <cfquery datasource="#DATASOURCENAME#" name="rQuery">
            <!---#PreserveSingleQuotes(sqlString)#--->
                INSERT INTO Notes
                    (title, noteData)
                VALUES
                    ('#arguments.title#','#arguments.note#')           
        </cfquery>
        <cfquery datasource="#DATASOURCENAME#" name='rQuery'>
            Select @@identity AS newId
        </cfquery>
       
        <cfreturn getNote(rQuery.newId)>
    </cffunction> --->
</cfcomponent>

auser.as
-----------------
/**
   @class ServiceOrdersBeta  
   @author BlueInstant.com & mikekollen.com
*/
import mx.controls.TextInput;
import mx.controls.List;
import mx.controls.ComboBox;
import mx.controls.Button;

import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;

import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;

//class ServiceOrders
class auser
{
    private var  cfConnection:NetConnection;
    private var  workOrders:RecordSet;
   
    /* Gui Componets*/
    //private var  serviceOrders:List;
    //private var  statusComboBox:ComboBox;
    //private var  submit:Button;
    //private var  license:TextInput;
    private var  path:String;
    private var  name:TextInput;
    private var  state:TextInput;
    private var  zip:TextInput;
    private var  email:TextInput;
    private var  submit_btn:Button;
   
    /*
    function ServiceOrders(p:String, cb:ComboBox, lb:List, txt:TextInput,
btn:Button)
    {
        license = txt;
        statusComboBox = cb;
        serviceOrders = lb;
        submit = btn;
        path = p;
        init();
    }
    */
    function auser(p:String, n:TextInput, s:TextInput, z:TextInput, e:TextInput,
btn:Button){
        path = p;
        name = n;
        state = s;
        zip = z;
        email = e;
        submit_btn = btn;
        init();
        }
    public function init():Void
    {
        /* listener for the TextInput*/
        //license.addEventListener("change", this);
        name.addEventListener("change",this);
        state.addEventListener("change",this);
        zip.addEventListener("change",this);
        email.addEventListener("change",this);
       
       
        /* listener for the ComboBox*/
        //statusComboBox.addEventListener("change", this);
       
        /* listener for the Button*/
        //submit.addEventListener("click", this);
        submit_btn.addEventListener("click",this);
        createConnection();
    }
    public function createConnection():Void
    {trace("connected");
        var a_user = new Service(path, null, "test.auser", null, null);
        var pendingUser:PendingCall = a_user.post();
        pendingUser.responder = new RelayResponder(this, "work","nowork");
        trace("pendingUser" + pendingUser);
    }
    public function click():Void{
        createConnection();
        }
    public function work():Void
    {
        trace("work");
    }
    public function nowork():Void
    {
        //trace("reportError: " + myFault.fault.faultstring);
        trace("nowork");
    }
    /*
    public function createConnection():Void
    {
        var work_Orders = new Service(path, null, "test.workOrder", null, null );
        var pendingWorkOrders:PendingCall = work_Orders.getWorkOrders();
        pendingWorkOrders.responder = new RelayResponder( this, "filterWorkOrders",
"reportError" );
       
        var status_Code = new Service(path, null, "test.statusCode", null, null );
        var pendingstatusCode:PendingCall = status_Code.getStatusCodes();
        pendingstatusCode.responder = new RelayResponder( this, "fillComboBox",
"reportError" );
    }
    */
   
    //public function fillComboBox(r:ResultEvent):Void
    //{
    //    /* Populate the ComboBox with the returned recordSet uses
DataGlue.bindFormatString to re-map fields so that label equals STATUS_NAME
field and data equals STATUS_ID field */
    //    DataGlue.bindFormatStrings( statusComboBox, r.result,
    //                                "#STATUS_NAME#",
    //                                "#STATUS_ID#" );
    //}
   
   
    //public function reportError(myFault:FaultEvent):Void
    //{
    //    trace("reportError: " + myFault.fault.faultstring);
    //}
   
    //public static function     FILTER_FUNCTION(record, obj ):Boolean
    //{
    //    /*    make the license text the same length of the obj.text length to compare
them */
    //    var licenseText:String = record.LICENSE.substr( 0, obj.txt.length );
       
    //    /*    Return true if both texts and ids are equal or if texts are equal and
id is "All
    //    *    Active" (id = 1). Otherwise returns false */
    //    return (licenseText == obj.txt && ( record.STATUS_ID ==  obj.id || obj.id
== 1) )
    //}

   
    //public function filterWorkOrders(r:ResultEvent):Void
    //{
    //    /* Keep a reference to the query returned casting to a recordset class*/
    //    if(r != undefined) workOrders = RecordSet(r.result);
       
    //    /* clean our List, removing all current items */
    //    serviceOrders.removeAll();
       
        /* this object will be passed to the filter function with two properties*/
//        var filterParams:Object = {};
       
        /* get the text typed in the TextInput and convert it to upper case*/
//        filterParams.txt = license.text.toUpperCase();
       
        /*    Get the selected item from the comboBox
        *    If this is undefined we assign the value 1, which corresponds to the ID of
"All
        *    Active"
        */
//        filterParams.id = (statusComboBox.selectedItem.data != undefined) ?
statusComboBox.selectedItem.data : 1;
       
        /* apply the filter that returns a new RecordSet */
//        var rec:RecordSet = workOrders.filter(FILTER_FUNCTION, filterParams);
       
        /* get the Iterator from this new filtered recordset and populate the List */
//        var it = rec.getIterator();
//        while( it.hasNext())
//        {
//            var record = it.next();
//            serviceOrders.addItem(record.LICENSE + " ( " +record.STATUS_NAME + " )",
record.WORK_ORDER_ID );
//        }
//    }

   
    //public function change():Void
    //{
    //    /*Every time an item in the dropDown is selected or text is typed in the
TextInput,
    //    * this method is called because it has been registered as a listener of
those two components*/
    //    filterWorkOrders();
    //}
   
    //public function click():Void
    //{    /* This method gets called whenever the submit button is released
    //    * because it has been registered as a listener of the button */
    //    openServiceManager();
    //}
    //public function openServiceManager():Void
    //{
    //    getURL("serviceManager.cfm?workOrder=" + serviceOrders.selectedItem.data  
+ "&license=" + license.text + "&status=" + statusComboBox.selectedItem.data);
    //}
   
   
}
jeffcg2 - 06 Sep 2004 16:27 GMT
I am looking for the difference. It seems the problem should be in these
sections of code.

import mx.rpc.RelayResponder;
This import statement is in both .as files. Seems like this should import the
RelayResponder class.
Strange thing is I have done a search of my C drive for "RelayResponder" and
it's not there.
I makes sense that both the .as files would give the error.

public function createConnection():Void
    {
        var work_Orders = new Service(path, null, "test.workOrder", null, null );
        var pendingWorkOrders:PendingCall = work_Orders.getWorkOrders();
        pendingWorkOrders.responder = new RelayResponder( this, "filterWorkOrders",
"reportError" );
       
        var status_Code = new Service(path, null, "test.statusCode", null, null );
        var pendingstatusCode:PendingCall = status_Code.getStatusCodes();
        pendingstatusCode.responder = new RelayResponder( this, "fillComboBox",
"reportError" );
    }

public function createConnection():Void
    {trace("connected");
        var a_user = new Service(path, null, "test.auser", null, null);
        var pendingUser:PendingCall = a_user.post();
        pendingUser.responder = new RelayResponder(this, "work","nowork");
        trace("pendingUser" + pendingUser);
    }

**Error** C:\Inetpub\wwwroot\test\auser.as: Line 79: The class
'mx.rpc.RelayResponder' could not be loaded.
             pendingUser.responder = new RelayResponder(this, "work","nowork");

Total ActionScript Errors: 1     Reported Errors: 1
jeffcg2 - 06 Sep 2004 17:56 GMT
Can someone explain this to me. I'm looking in this directory.

C:\Program Files\Macromedia\Flash MX 2004\en\First Run\Classes\mx

Looking at these import statements.

import mx.controls.TextInput;
import mx.controls.List;
import mx.controls.ComboBox;
import mx.controls.Button;

import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;

import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;

I can find a subdirectory under mx/controls with TextInput.as, List.as,
ComboBox.as, Button.as.

I can find a subdirectory mx/remoting with only another subdirectory /debug no
*.as files

I can not find a subdirectory mx/rpc.

Where/How can the working sample be importing something that is not there???
jeffcg2 - 06 Sep 2004 18:48 GMT
I've redownloaded and installed the 7.2 updater for Flash MX 2004 -
flmx2004_702update_en.exe on 9/4
I've redownloaded, uninstalled and reinstalled the Flash Remoting components -
flashremoting_comp_as20-win-en.exe
http://www.macromedia.com/software/flashremoting/downloads/components/

Apparently the installers don't install properly.
jeffcg2 - 06 Sep 2004 22:02 GMT
IMHO Flash and Data integration are still not ready for prime time.

Since Macormedia would NOT give me a refund, I keep checking periodically on
these forums to see if there is a sign
they intend to support Flash Remoting. Still no useful examples. Still no help
with why the examples they do have won't work. All I see here are a bunch of
people asking questions with no answers.

Google searchs provide more evidence that nobody (that's talking) knows how to
use it.

Someday they may find that other people like myself will wait till I see
something that works before they get any more of my hard earned money.

It was a year and a half after I first tried to use Coldfusion MX that they
finally fixed it.

It's been over a year since I forked over my money for the promise of Flash
with data.

Maybe another 6 months or a year they will fix that too.
dr_bozak - 06 Sep 2004 22:45 GMT
jeff jeff jeff ...

first of all ...
yeah .. macromedia is whack. their docs suck, their examples suck, and their
marketers ought to be hung by their thumbs and covered in ASP 1.0 code and be
forced to use FrontPage

second of all ...

take a deep breath of fresh air (or whatever suits you)
it's just not worth it.
obviously the docs are half assed and not thorough or more than 80% of this
forum would be empty.
give macromedia and others some time to fix their product and write some books.
poor remoting support is probably why MS always wants to use XML instead of
remoting.
..................
I can say this:

yeah flash remoting has its confusing points.
somehow, it does work. the poeple that designed it and developed it can get it
to work Im sure.
the idea of it is awesome right? that's why you and I are struggluing with
BASIC STUFF, so we can get through to other side (if it actually exists)

yeah macromedia examples are really weak, but their are a more than a couple
texts out there to help where they left off.
I went through chap23 of CF MX WACK by Forta today, and that worked
beautifully. Well documented, downloadable code ... maybe give it a peek.

I used CF since before macromedia bought it, and yeah it used to have less
problems. but it also had less features.

like with any new product, there are bugs.

my ISP recommended not using CFMX (as of 2003) until macromedia had wrorked
out all the bugs they introduced by re-writing it in java.

the main problem I think you're having, is that:

there are not really any full on good examples here.
exmaples yes .. lots of em .. comprehensive useful examples ... no. not here
....
not really anywhere googeable ...

but life is to short to be frusturated with some hacked together technology
that is poorly documented.

talk a walk .. come back.

forget these useless forums and the 95% unanswered questions to %5 answers and
look elsewhere for the answers.

maybe someday the technical writers at macromedia will get to work and add to
the lacking docs/examples.
if they spent as much time documenting, as they did marketing it would be
great wouldn't it?

marketers always f*** things up.
just think, somewhere there is a team of programmers that worked really hard
on remoting, that want us developers to use it, but somehow the data flow broke
down and instead of using an awesome product that is well documented, we're
here in this forum wasting our breath pleading for an explanation how we can
get down with "what the web can be".

oh did I mention that I don't care much for marketers?
jeffcg2 - 07 Sep 2004 04:20 GMT
Finally got past this error.

**Error** C:\Inetpub\wwwroot\test\auser.as: Line 79: The class
'mx.rpc.RelayResponder' could not be loaded.
pendingUser.responder = new RelayResponder(this, "work","nowork");

Total ActionScript Errors: 1 Reported Errors: 1

I found this posting in another thread..
_______________
Did you drag instances of the remoting classes on to your movie stage?

In Flash, navigate to: Window -> Other Panels -> Common Libraries -> Remoting

Drag both of the library items on to your stage and try testing your movie
again.
_________________--
jeffcg2 - 07 Sep 2004 05:16 GMT
dr_bozak,

I see you are just getting started with this mess. I was where you are about
last Christmas.  

Don't waste your time with all the AS 1 examples. Eventually you'll find out
that they just are not really compatible with Flash MX 2004. Yes they will run
but will not play with anything else. You have to go down a completely
different development path.
dr_bozak - 07 Sep 2004 15:52 GMT
really?
AS 1.0 code doesn't work with MX 2004

that really really sucks ...

aren't languages usually backwards compatible?

what is different .. or perhaps more usefully, have you found any references
that you could poinbt me to so thast I can see the difference.

thanks
jeffcg2 - 08 Sep 2004 03:16 GMT
dr_bozak,
I don't have anything particular other than  Tom Muck who knows a lot more than me said YES when I asked if I should wait for AS 2 Flash Remoting. That was just before Christmas..
MarkP56 - 29 Sep 2004 11:32 GMT
Yes this is the answer for my problem too,

There are to many tricks in this product to be aware of.

costed me one precious hour again

thanx
jeffcg2 - 11 Sep 2004 00:58 GMT
Hope this will be helpful to others wrestling with Flash Remoting.

This is my latest attemp. It does work.
http://209.107.237.165/test/user.swf

I added a dropdown just to see that something was happening.

auser.as file
_______________________
import mx.controls.TextInput;
import mx.controls.List;
import mx.controls.ComboBox;
import mx.controls.Button;

import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;

import mx.controls.DataGrid;
import mx.controls.gridclasses.DataGridColumn;

import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;

//class ServiceOrders
class auser
{
    private var  cfConnection:NetConnection;
    private var  workOrders:RecordSet;
   
    /* Gui Componets*/
    //private var  serviceOrders:List;
    //private var  statusComboBox:ComboBox;
    //private var  submit:Button;
    //private var  license:TextInput;
    private var  path:String;
    private var  name_txt:TextInput;
    private var  state_txt:TextInput;
    private var  zip_txt:TextInput;
    private var  email_txt:TextInput;
    private var  user_cb:ComboBox;
    private var  user_grd:DataGrid;
    private var  submit_btn:Button;
   
    /*
    function ServiceOrders(p:String, cb:ComboBox, lb:List, txt:TextInput,
btn:Button)
    {
        license = txt;
        statusComboBox = cb;
        serviceOrders = lb;
        submit = btn;
        path = p;
        init();
    }
    */
    function auser(p:String, n:TextInput, s:TextInput, z:TextInput, e:TextInput,
cb:ComboBox, grd:DataGrid, btn:Button){
        path = p;
        name_txt = n;
        state_txt = s;
        zip_txt = z;
        email_txt = e;
        user_cb = cb;
        user_grd = grd;
        submit_btn = btn;
        init();
        }
    public function init():Void
    {
        /* listener for the TextInput*/
        //license.addEventListener("change", this);
        //name_txt.addEventListener("change",this);
        //state_txt.addEventListener("change",this);
        //zip_txt.addEventListener("change",this);
        //email_txt.addEventListener("change",this);
       
       
       
        /* listener for the ComboBox*/
        //statusComboBox.addEventListener("change", this);
        user_cb.addEventListener("change",this);
       
        /* listener for the Button*/
        //submit.addEventListener("click", this);
        submit_btn.addEventListener("click",this);
        //createConnection();
        get_Users();
    }
    public function get_Users():Void{
        var get_user = new Service(path, null, "test.auser", null, null);
        var pendingGetUser:PendingCall = get_user.getUsers();
        pendingGetUser.responder = new RelayResponder(this,
"fillCombobox","reportError");
        trace("get users");
        }
    public function createConnection():Void{
   
        var a_user = new Service(path, null, "test.auser", null, null);
        if(name_txt.text == ""){
            trace("Name required.");
        }else if(state_txt.text == ""){
            trace("State required.");
        }else if(zip_txt.text == ""){
            trace("Zip required.");
        }else if (email_txt.text == ""){
            trace("Email required");
            }else{
        var pendingUser:PendingCall =
a_user.post(name_txt.text,state_txt.text,zip_txt.text,email_txt.text);
        pendingUser.responder = new RelayResponder(this, "work","nowork");
        }
        trace("create Connection");
    }
    public function reportError(myFault:FaultEvent):Void
    {
        trace("reportError: " + myFault.fault.faultstring);
    }
    public function fillComboBox(r:ResultEvent):Void
    {
        /* Populate the ComboBox with the returned recordSet uses
DataGlue.bindFormatString to re-map fields so that label equals STATUS_NAME
field and data equals STATUS_ID field */
        DataGlue.bindFormatStrings(user_cb, r.result,
                                    "#NAME#"+"-"+"#STATE#"+"-"+"#ZIP#"+"-"+"#EMAIL#",
                                    "#MYTESTID#" );
       
       
        trace("fill user_cb");
    }
    public function click():Void{
        createConnection();
        name_txt.text = "";
        state_txt.text = "";
        zip_txt.text = "";
        email_txt.text = ""
        get_Users();
        }
    public function change():Void{
        get_Users();
        trace("change made");
        }
    public function work():Void
    {
        trace("work");
    }
    public function nowork():Void
    {
        trace("nowork");
    }
}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.