Bugger, stuffed up the example code - noticed it as soon as I sent it, should read like this:

myRecord_result = function(result) {
  firstName_txt.text = result.items[0].firstName;
  lastName_txt.text = result.items[0].lastName;
  email_txt.text = result.items[0].email;
}

Andrew

Andrew Muller wrote:


Jason


The sample code looks as though it's got a lot of extra handling to me.

The first thing I'd say to you is that I'm a very visual person and I need to know what's going on when I develop...

Are you including NetDebug.as so that you can use the NetConnection Debugger, that's gunna help you see what's going on straight away.

Let's assume that the record set returned from your cfc has three columns:

firstName, lastName & email

If you had textfields to then populate with that data you'd have to first create a dynamic textfield per value and give each an instance name. Common practice is to use the suffix "_txt". So let's say you have three dynamic textfields with the instance names:

firstName_txt, lastName_txt & email_txt

Values can be assigned to the "text" property of a textfield.

ColdFusion queries are always returned by Flash Remoting to the Flash movie as an array of objects called "Items", where each index of the array is a record and the object contained in that index has one property per column. ActionScript arrays commence their numbering at 0 instead of 1.

The bare bones handler in your ActionScript to respond to the result coming from your cfc would firstly be equal to the method called with the suffix "_result" and, based on the examples given above, could look like this (assuming the method called is named "myRecord" and that the RecordSet contained only one record):

myRecord_result = function(result) {
  firstName_txt = result.items[0].firstName;
  lastName_txt = result.items[0].lastName;
  email_txt = result.items[0].email;
}

There are other ways that this can be written that are more object oriented and more dynamic but this will get the job done and should be kinda straight forward to read.

There's a basic four part Remoting tutorial on the Daemon site you might like to check out as well:

http://www.daemon.com.au/go/training/tips-and-tricks/flash-remoting-1
http://www.daemon.com.au/go/training/tips-and-tricks/flash-remoting-2
http://www.daemon.com.au/go/training/tips-and-tricks/flash-remoting-3
http://www.daemon.com.au/go/training/tips-and-tricks/flash-remoting-4

HTH

Andrew


Jason Bayly wrote:


Thats the one andrew, sorry i'm kinda new to the actionscritp brainspace.

I havnt gotten to the preselecting the combo boxes yet.. (getting there)
Where im at is trying to do something meaningful with the query results that
are handed back from the cfc..


Do i need to do any thing fancy with them, or do i just assign the values to
the text fields etc? Im having trouble working out how to get at the record
returned from the CFC.. i seem to be be getting undefied alot when tracing
out values.... :-S
Mark reccomended the code below but i cant tell if its working or not, or
waht to do next.. i output MyJob.Fieldname and get undfined..


Any pointers appreciated

jason

MyJob = new Object();
LookUpJob_Result = function (result) {
myResult = result.Items;
for (var i = 0; i < myResult.length; ++i) {
         for (col in myResult[i]){MyJob[col] = myResult[i][col];}
     }
}




-- Andrew Muller Senior Macromedia Certified Instructor - ColdFusion, Flash Certified Advanced Macromedia ColdFusion Developer - CF5, CFMX Certified Macromedia Flash Developer - FL5, FMX

Daemon Internet Consultants
[EMAIL PROTECTED]
Macromedia Certified Training
http://www.daemon.com.au/go/training
T: 61 2 9380 4162
F: 61 2 9380 4204
17 Roslyn Gardens
Elizabeth Bay NSW 2011 AUSTRALIA

Daemon: Serious Web Development

FarCry, the open source CMS for ColdFusion MX
http://farcry.daemon.com.au/


--- You are currently subscribed to fugli as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to