Chapter 4. Flash Remoting Internals

I learned how to program by pulling apart existing programs and trying to figure out how they worked. This was back in 1982, when the hottest computer around was the Commodore 64. My approach was to load an existing program, run it, and then look at the code line by line. I would comment each line of the code with my observations of what the program was doing. After some practice, I got pretty good at discovering what other people's code did. I also got pretty good at writing my own code.

The code was assembly language. Although the properties, methods, and events of modern-day languages make it easy to accomplish complex tasks with one or two lines of code, a simple statement like myService.getSearchResults(string) might require hundreds of lines of assembly language. Little wonder that I went through 7,000 sheets of tractor-feed printer paper. Despite its drawbacks, the flip side of assembly language is that it gives you access to the core underpinnings of the software and hardware. If you understand the assembly language, you really understand everything the program does.

The goal of Flash Remoting is to take complex tasks and abstract them so that you, the programmer, can accomplish more with each line of code than was previously possible. But saying "it just works" isn't very satisfying to programmers who want to understand Flash Remoting at a deeper level. Especially because sometimes it doesn't "just work," a deeper technical understanding can help you solve otherwise vexing problems.

The preceding chapters have shown you a few examples of the technology and how to use it. Now that Flash Remoting's concepts are familiar to you, it is a good time to dive more deeply into the different classes, objects, and components of Flash Remoting. What exactly are NetServices and createGatewayConnection( ) and why do they work as they do?

Following the discussion of some of Flash Remoting's internals, this chapter explores other topics in depth. This chapter includes many practical details on responder objects and callback functions, recordset objects, error trapping, and registering objects for transmission between the client and server. This chapter gives a new understanding of Flash Remoting, so you can decide when to sit back and enjoy the cruise control and when to tinker under the hood. It should be read carefully by all developers, so buckle up.

    Part III: Advanced Flash Remoting