Click on any phrase to play the video from that point.
[ADOBE DEVELOPER CONNECTION]
Hi, I'm Terry Ryan, ColdFusion Evangelist for Adobe.
Today, I want to talk to you about ColdFusion and Flash Builder.
Now, if you're like me, you're a longtime ColdFusion developer,
you switch to Flex to do your front-ends,
you may have run into some problems getting started with Flex.
There's a couple things there--there's one that Flex--the mindset, the taste to develop Flex
is very different than the mindset to develop ColdFusion.
There's also the fact that a lot of the work of connecting back-end ColdFusion systems
to Flex front-end applications is rote--
that you do the same remote object over and over and over again,
you're just changing the connection parameters.
So the Flash Builder engineers have done a great job in this version
solving that problem,
basically making all of this rote work that you do easy.
And so I'm going to show you the features of Flash Builder
that specifically just pull in ColdFusion services and allow you to wire them
into your application seemlessly.
So let me get started.
So switching over here, looking at ColdFusion,
I have a simple ColdFusion CFC.
You'll see that it is called personService over here,
and it basically provides remote access to person.cfc.
So if you look at personService here, you'll see that I've got
all of the functions you would need to do a typical create, read, update, destroy,
or CRUD operation.
I've got a list here, I've got a get, I've got an update,
I've got a destroy, and I've got a search, so all of these methods
are in the CFC, they're all set to remote so I can use them easily from Flex.
So normally what I'd have to do is I'd have to go in
and I'd have to create a remote object in Flex and pull all this stuff in,
but Flash Builder has within it this new Data Services piece,
so if I look down here--here's my Flash application
and my Flex application is completely blank.
And down here, I've got Data Services.
If I click on Data Services, it brings up this menu here where I can choose
from a number of different types of data services.
Since this is a ColdFusion project, I can choose ColdFusion,
I can just do a simple HTTP service or a web service or straight XML,
but I'm going to choose ColdFusion, and that's going to enable
Flash remoting on the back-end and really a lot of speed.
So now, it's asking me for a CFC location.
It's asking me specifically where on the disk that Service CFC that I showed you
a second ago was, so I'm going to point it to it.
I'm going to say here's Team>>services>>personService.cfc.
I hit Next and it's going to ask me for my username and password.
That's fine, I'll hit Enter.
And now, introspected, you see it just took a second to do,
but what it did is it introspected that CFC,
figured out all those methods, and figured out what inputs and outputs it would have.
So you see here, not only does it say get,
but it knows it's going to take a Number id and it's going to return a Person.
Destroy is going to take a person: Object and return void,
and so on and so forth.
So I'm going to hit Finish--
it's going to take a second to write all the code for me.
But now, if I look down here in Data Services,
you'll see that I've got the count, destroy, get, list, search, update methods
all wired up for me already.
Not only that, but it also looked at the Data Types,
it looked at Person, it looked at firstName, lastName, personID, and username.
So it got all that information from ColdFusion
and just wired it all up for me.
So how would I now show this?
This is the next step--so I'm going to take a data grid,
I'm going to drop it down, and I'm going pull it out, and you'll see
that it's just a standard data grid--it's got 3 columns that are completely empty.
There's no data bound to it, so it just says Column 1, Column 2, Column 3.
Now, here's where this gets crazy.
See down here in Data Services?
I'm going to take list(), I'm going to drag it
to the data grid, and when I do that, I snap it.
It gives me a little dialogue box and I just take the defaults, and boom--there you go.
The data grid has now rewritten itself to be the columns from the service,
so personID, username, firstName, lastName.
But more than that, if I hit Compile,
and it takes a second--there you go--you'll see that there I am with that data grid,
completely wired up with data.
So there's the other members of my team, there's me,
there's Ryan Stewart, Kevin, Lee, etc., etc.
So I've now wired up a data grid with data without writing any code,
which is pretty cool, but I don't want to just show that data;
I want to manipulate it, I want to edit it.
So normally what I'd do is I'd build a form and I'd build it piece by piece.
I'd create inputs, drag them on, attach them to the data grid,
but the engineers for the Flash Builder team have really just made that easy for me,
so I'm going to go here to Generate Details Form...
hit OK and it's going to give me a number of options.
We're just going to take the default, we'll hit Next,
and you'll see that it says which elements do I want I my form?
And again, I'm just going to take the defaults, I'll hit Finish,
and now you'll see there it dropped that form on top of the data grid,
which is suboptimal, but I just move it over, and there you go.
So I've got personID, username, firstName, lastName
all ready to go in this form, and in fact, if I hit Compile,
you'll see that when I click on these elements,
that form is populating, and not only that, but I can go over here
and I can edit it, so I can change me from Terrence--
what my mother calls me when she's angry at me--to just Terry.
Hit Submit, and it changes it in the data grid.
Now, that's cool, but you'll notice if I hit Refresh,
that data hasn't changed,
so I changed it in the data grid but I didn't change it back in the database,
so that requires one more step
and will require the only line of code I have to touch in this entire demonstration.
So there's my Submit form, and right down here I've got update method, right?
That update method will update the database, so I take this update method
and I still can't get over how cool this is--but I'm just going to drop it onto that button,
and when I do, it's finally going to prompt me to write a little piece of code.
Now, it's asking me what is this object that I'm going to pass back to the server?
And in this case, it just so happens that it's person, right?
Because up here, this is the piece that the data grid is talking to the form.
it's person--I just say that same person is the same thing,
I hit Save, and then when I Compile,
you'll see here I go through again--I'll hit Terrence,
again, I'll change me back to the less formal Terry, hit Submit.
Now, when I hit refresh, it goes back out of the database, pulls the info in--
it's been changed to Terry also in the database.
So there you have it--I just wired a ColdFusion back-end
up to a Flex front-end
with just a couple of mouse clicks and one set of variable assignment in code.
It's really that easy; it's really that simple.
If you want to learn more about doing this yourself in your own projects,
go to the Learning Flex and ColdFusion section of the Adobe Developer Connection.
Thank you.
adobe.com/devnet/flex/flex_cf.html
[ADOBE DEVELOPER CONNECTION]



