mgrubervs
05-26-2006, 06:55 PM
:confused:
I am new to this forum and hope someone out there can offer a suggestion.
Someone please help... my job is on the line. I have created a small flash file that is using amfphp mysql and flash to populate a listbox.
Basically, this seems to be working well on some machines... and not at all on others... and sometimes on others. You can view the site at:
http://www.gullscove.com/menu.html
Navigate to 'Units' and then 'Unit Selector'
The issue is that some machines can get this to work on minute... and then reload it and it doesn't work. Also, when I run the service call, it doesn't trip the Fault response when it doesn't work.
Can anyone offer a suggestion?!?!
Here is my code:
/*_________________________________________________ _________________________
IMPORT CLASSES
__________________________________________________ _________________________*/
// ActionScript reference to a remote service
import mx.remoting.Service;
// All remote function calls return a PendingCall
import mx.remoting.PendingCall;
// Relays the remote or response to the correct function
import mx.rpc.RelayResponder;
// In the event of a successful function call, use a ResultEvent
import mx.rpc.ResultEvent;
// In the event of an error, use a FaultEvent
import mx.rpc.FaultEvent;
// use DataGlue to bind the incoming Object to CB or LB
import mx.remoting.DataGlue;
// If using the NetConnection debugger, use this class (only during testing)
import mx.remoting.debug.NetDebug;
// use RecordSet class to handle query object returned from CFC in Flash
import mx.remoting.RecordSet;
/*_________________________________________________ _________________________
REMOTING SERVICES and FUNCTIONS
__________________________________________________ _________________________*/
// Start the debugger
NetDebug.initialize();
// Set up variables for the URL and service paths GATEWAY URL
var myURL:String = "http://www.gullscove.com/amfphp/gateway.php";
//var myURL:String = "http://www.mgruberdesign.com/amfphp/gateway.php";
// SERVICE NAME
var myServiceName:String = "UnitSelector";
// Create connection reference to service and create service object
var myService:Service = new Service(myURL, null, myServiceName);
//define unitType variable (temp for testing)
numRooms = 0;
// SERVICE CALL
// call the SERVICE FUNCTIONS numRooms = Unit Type (Studio, 1 Bed, 2 Bed)
var unitTypesService:PendingCall = myService.getUnitType(numRooms);
// tell the service what methods handle result and fault conditions
unitTypesService.responder = new RelayResponder(this, "unitTypesService_Result","unitTypesService_Fault");
// UNIT TYPES FUNCTION __________________________________________________ _________________________
function unitTypesService_Result(unitTypesServiceResult:Res ultEvent){
trace("SUCCESS");
DataGlue.bindFormatStrings(units_lb, unitTypesServiceResult.result, "#number#", "#unit_id#" );
//trace(unitTypesServiceResult.result);
trace(newline + "unit_id:" + unitTypesServiceResult.result.getItemAt(0).unit_id );
//trace(newline + "area:" + unitTypesServiceResult.result.getItemAt(0).area);
// create variable RS for record set
_global.rs = RecordSet(unitTypesServiceResult.result);
// format result of FR call
formatDetails(_global.rs.getItemAt(0),unit_id);
}
// FAULT function
function unitTypesService_Fault(unitTypesServiceFault:Fault Event){
//display fault returned from service
//description_txt.text = unitTypesServiceFault.fault.faultstring;
}
// call the SERVICE FUNCTIONS
function serviceCall(numRooms:Number){
// call the SERVICE FUNCTIONS numRooms = Unit Type (Studio, 1 Bed, 2 Bed)
var unitTypesService:PendingCall = myService.getUnitType(numRooms);
// tell the service what methods handle result and fault conditions
unitTypesService.responder = new RelayResponder(this, "unitTypesService_Result","unitTypesService_Fault");
}
// PROJECTS INFO FUNCTIONS __________________________________________________ ______________________________
// format details
function formatDetails(rs:Object,unit_id:Number):Void{
trace(newline + "[unit_id] = " + rs.unit_id);
trace("[number] = " + rs.number);
// trace("[floor] = " + rs.floor);
trace("[rooms] = " + rs.rooms);
trace("[area] = " + rs.area);
//trace("[availability] = " + rs.availability);
// ASSIGN VALUES to GLOBAL VARIABLES
_global.unit_unit_id = rs.unit_id;
_global.unit_number = rs.number;
//_global.unit_floor = rs.floor;
_global.unit_rooms = rs.rooms;
_global.unit_area = rs.area;
//_global.unit_availability = rs.availability;
unloadMovie(thumb_mc);
loadMovie(_global.theSelectedThumb, thumb_mc);
}
/*_________________________________________________ _________________________
VIEW Functions
__________________________________________________ _________________________*/
// UPDATE
_global.update = function() {
// set textFields
unitNum_txt.text = "Unit: " + _global.unit_number + " – " + _global.unitTypeName;
unitArea_txt.text = "Area: " + _global.unit_area + " sq. ft.";
}
/*_________________________________________________ _________________________
RUN AT ONCE COMMANDS
__________________________________________________ _________________________*/
serviceCall(0);
unitNum_txt.text = " ";
unitArea_txt.text = " ";
stop();
One last thing... when I test a simple PHP query... it works
http://www.gullscove.com/testconnect.php
If you have any ideas, please reply
Thank you.
I am new to this forum and hope someone out there can offer a suggestion.
Someone please help... my job is on the line. I have created a small flash file that is using amfphp mysql and flash to populate a listbox.
Basically, this seems to be working well on some machines... and not at all on others... and sometimes on others. You can view the site at:
http://www.gullscove.com/menu.html
Navigate to 'Units' and then 'Unit Selector'
The issue is that some machines can get this to work on minute... and then reload it and it doesn't work. Also, when I run the service call, it doesn't trip the Fault response when it doesn't work.
Can anyone offer a suggestion?!?!
Here is my code:
/*_________________________________________________ _________________________
IMPORT CLASSES
__________________________________________________ _________________________*/
// ActionScript reference to a remote service
import mx.remoting.Service;
// All remote function calls return a PendingCall
import mx.remoting.PendingCall;
// Relays the remote or response to the correct function
import mx.rpc.RelayResponder;
// In the event of a successful function call, use a ResultEvent
import mx.rpc.ResultEvent;
// In the event of an error, use a FaultEvent
import mx.rpc.FaultEvent;
// use DataGlue to bind the incoming Object to CB or LB
import mx.remoting.DataGlue;
// If using the NetConnection debugger, use this class (only during testing)
import mx.remoting.debug.NetDebug;
// use RecordSet class to handle query object returned from CFC in Flash
import mx.remoting.RecordSet;
/*_________________________________________________ _________________________
REMOTING SERVICES and FUNCTIONS
__________________________________________________ _________________________*/
// Start the debugger
NetDebug.initialize();
// Set up variables for the URL and service paths GATEWAY URL
var myURL:String = "http://www.gullscove.com/amfphp/gateway.php";
//var myURL:String = "http://www.mgruberdesign.com/amfphp/gateway.php";
// SERVICE NAME
var myServiceName:String = "UnitSelector";
// Create connection reference to service and create service object
var myService:Service = new Service(myURL, null, myServiceName);
//define unitType variable (temp for testing)
numRooms = 0;
// SERVICE CALL
// call the SERVICE FUNCTIONS numRooms = Unit Type (Studio, 1 Bed, 2 Bed)
var unitTypesService:PendingCall = myService.getUnitType(numRooms);
// tell the service what methods handle result and fault conditions
unitTypesService.responder = new RelayResponder(this, "unitTypesService_Result","unitTypesService_Fault");
// UNIT TYPES FUNCTION __________________________________________________ _________________________
function unitTypesService_Result(unitTypesServiceResult:Res ultEvent){
trace("SUCCESS");
DataGlue.bindFormatStrings(units_lb, unitTypesServiceResult.result, "#number#", "#unit_id#" );
//trace(unitTypesServiceResult.result);
trace(newline + "unit_id:" + unitTypesServiceResult.result.getItemAt(0).unit_id );
//trace(newline + "area:" + unitTypesServiceResult.result.getItemAt(0).area);
// create variable RS for record set
_global.rs = RecordSet(unitTypesServiceResult.result);
// format result of FR call
formatDetails(_global.rs.getItemAt(0),unit_id);
}
// FAULT function
function unitTypesService_Fault(unitTypesServiceFault:Fault Event){
//display fault returned from service
//description_txt.text = unitTypesServiceFault.fault.faultstring;
}
// call the SERVICE FUNCTIONS
function serviceCall(numRooms:Number){
// call the SERVICE FUNCTIONS numRooms = Unit Type (Studio, 1 Bed, 2 Bed)
var unitTypesService:PendingCall = myService.getUnitType(numRooms);
// tell the service what methods handle result and fault conditions
unitTypesService.responder = new RelayResponder(this, "unitTypesService_Result","unitTypesService_Fault");
}
// PROJECTS INFO FUNCTIONS __________________________________________________ ______________________________
// format details
function formatDetails(rs:Object,unit_id:Number):Void{
trace(newline + "[unit_id] = " + rs.unit_id);
trace("[number] = " + rs.number);
// trace("[floor] = " + rs.floor);
trace("[rooms] = " + rs.rooms);
trace("[area] = " + rs.area);
//trace("[availability] = " + rs.availability);
// ASSIGN VALUES to GLOBAL VARIABLES
_global.unit_unit_id = rs.unit_id;
_global.unit_number = rs.number;
//_global.unit_floor = rs.floor;
_global.unit_rooms = rs.rooms;
_global.unit_area = rs.area;
//_global.unit_availability = rs.availability;
unloadMovie(thumb_mc);
loadMovie(_global.theSelectedThumb, thumb_mc);
}
/*_________________________________________________ _________________________
VIEW Functions
__________________________________________________ _________________________*/
// UPDATE
_global.update = function() {
// set textFields
unitNum_txt.text = "Unit: " + _global.unit_number + " – " + _global.unitTypeName;
unitArea_txt.text = "Area: " + _global.unit_area + " sq. ft.";
}
/*_________________________________________________ _________________________
RUN AT ONCE COMMANDS
__________________________________________________ _________________________*/
serviceCall(0);
unitNum_txt.text = " ";
unitArea_txt.text = " ";
stop();
One last thing... when I test a simple PHP query... it works
http://www.gullscove.com/testconnect.php
If you have any ideas, please reply
Thank you.