all groups > coldfusion flash integration > july 2006 >
You're in the

coldfusion flash integration

group:

Flash Remoting


Flash Remoting lgschulz
7/11/2006 5:56:38 PM
coldfusion flash integration:
Re: Flash Remoting reya276
7/11/2006 6:28:31 PM
Re: Flash Remoting lgschulz
7/11/2006 6:48:42 PM
I am not sure home much code you need. So here is part of it and if you need
more let me know.

main page:


<body>
<table id="container"><tr><td>
<cfform name="MaterialDB" format="flash" width="990" height="600"
preservedata="yes" onLoad="initApp()" style="themeColor:##56A1E1;
marginRight:-12; background-color:##37749D;">
<!-- This is telling the columns to wordwrap of the text is larger than field
size. -->
<cfformitem type="script">
public function initApp():Void
{
MaterialDB.myGlobalObjects = {};
MaterialDB.myGlobalObjects.isEditMode = false;
<!--- set up remoting service --->
setUpRemoting();
<!--- set up styles --->
setStyles();

var gridMaterial=gridMaterial;
gridMaterial.variableRowHeight = true;
gridMaterial.getColumnAt(2).wordWrap = true;
gridMaterial.getColumnAt(3).wordWrap = true;
gridMaterial.getColumnAt(5).wordWrap = true;
gridMaterial.getColumnAt(6).wordWrap = true;
}
public function setUpRemoting():Void{
<cfoutput><!--- cfoutput to be able to set the gateway dynamically. It is
recommended however to write the actual gateway instead --->
<!--- var connection:mx.remoting.Connection =
mx.remoting.NetServices.createGatewayConnection("http://#cgi.HTTP_HOST#/flashser
vices/gateway/");
this should evaluate to --->
var componentPath = MHC.components.ListingGateway";
<!--- componentPath variable is controlled in Application.cfc for more
flexibilty on where the sample application has been saved
--->
var componentPath:String = "#request.componentPath#.services.ListingService";
</cfoutput>
var responseHandler:Object = {};

<!--- put controls in the responseHandler's scope --->
var gridMaterial:mx.controls.DataGrid = gridMaterial;

<!--- handle search by default onResult function --->
responseHandler.onResult = function( results: Object ):Void {

gridMaterial.dataProvider = results;
_root.setMode('add');
mx.managers.CursorManager.removeBusyCursor();
}

<!--- this function is called when search button is clicked --->
public function submitSearch():Void
{
<!--- get all the search criteria items --->
var searchArguments:Object = {};
<!--- show clock cursor --->
mx.managers.CursorManager.setBusyCursor();
<!--- call service --->
MaterialDB.myGlobalObjects.listingService.search(searchArguments);
}
</cfformitem>
Re: Flash Remoting lgschulz
7/11/2006 7:16:42 PM
I sent the wrong code. Here is the updated code.
<cfscript>
//make an empty query to prepopulate grid, only needed due to data mask
SearchMaterials = queryNew("PART_NUMBER, DESCRIPTION, MATERIAL_DESCRIPTION,
SELECTION_CODE, MIUL_REMARKS, MP_COMMENTS","varchar, varchar, varchar, varchar,
varchar, varchar");

</cfscript>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Material Hardware Connector Database</title>
<style >
html, body{
height:100%;
margin:0;
}
body{
background: #202020 url(assets/images/patternBg.gif);
}
#container{
margin: auto;
background: #195075 url(assets/images/background.gif) center center repeat-x;
width: 950px;
border: 1px solid #222;
height: 100%;
}
</style>
</head>
<body>
<table id="container"><tr><td>
<cfform name="MaterialDB" format="flash" width="990" height="600"
preservedata="yes" onLoad="initApp()" style="themeColor:##56A1E1;
marginRight:-12; background-color:##37749D;">

<cfformitem type="script">
public function initApp():Void
{
MaterialDB.myGlobalObjects = {};
MaterialDB.myGlobalObjects.isEditMode = false;
<!--- set up remoting service --->
setUpRemoting();

<!--- This is telling the columns to wordwrap of the text is larger than field
size. --->
var gridMaterial=gridMaterial;
gridMaterial.variableRowHeight = true;
gridMaterial.getColumnAt(2).wordWrap = true;
gridMaterial.getColumnAt(3).wordWrap = true;
gridMaterial.getColumnAt(5).wordWrap = true;
gridMaterial.getColumnAt(6).wordWrap = true;
}
public function setUpRemoting():Void{
<cfoutput>
<!--- cfoutput to be able to set the gateway dynamically. It is recommended
however to write the actual gateway instead --->
var connection:mx.remoting.Connection =
mx.remoting.NetServices.createGatewayConnection("http://localhost:8500/flashserv
ices/gateway/");

</cfoutput>
var responseHandler:Object = {};

<!--- put controls in the responseHandler's scope --->
var gridMaterial:mx.controls.DataGrid = gridMaterial;

<!--- handle search by default onResult function --->
responseHandler.onResult = function( results: Object ):Void {

gridMaterial.dataProvider = results;
_root.setMode('add');
mx.managers.CursorManager.removeBusyCursor();
}

<!--- this function is called when search button is clicked --->
public function submitSearch():Void
{
<!--- get all the search criteria items --->
var searchArguments:Object = {};
<!--- show clock cursor --->
mx.managers.CursorManager.setBusyCursor();
<!--- call service --->
MaterialDB.myGlobalObjects.listingService.search(searchArguments);
}
</cfformitem>
AddThis Social Bookmark Button