ColdFusion, WDDX, and Flash (Page 5 of 8)


Our Flash movie is quite simple. The source files for this tutorial included a Flash5 and FlashMX version of our Flash interface. Open the Flash file that corresponds to the version of Flash you are running. The basic layout of the movie has already been created. There are two layers: actions, which will hold all of our ActionScript code and employees which will hold our interface elements. The employees layer comes with 4 text fields already created, which match the columns in our database that we want to display. Creating some dynamic text fields to match these column titles and writing some action script code is all we have left to do in order to complete this tutorial.

Get started by creating 4 dynamic text fields, one just to the right of each of the 4 column titles. The dynamic text field just to the right of the EmployeeID column title should be named EmployeeID. The other dynamic text fields should be named FirstName, LastName, and PhoneExtension respectively. If you are working in Flash5, you will place these variable names in the Variable text box which is located in the Text Options tab of the Text Options panel. In FlashMX, the variable names should be created as Instance Names in the Properties panel. So, we have a Flash movie, the Flash movie has text headers for each of the database columns we want to display, and we have corresponding dynamic text fields to hold the data that Flash reads in. All that is left now is the ActionScript code that will call the ColdFusion template and parse the WDDX packet. But how exactly does Flash read the data in? How does the dynamic text fields get populated with the data? And more importantly, how does each text field get populated with the RIGHT data?