While it’s fairly easy to use ColdFusion pages and the Flash variable scope to interact with a Flash movie, it can be a bit awkward at times. In some cases, you may not want to deal with a different CFML file for each method that makes up your service. Also, while the Flash scope isn’t hard to use, wouldn’t it be much nicer if you could just pass various datatypes, such as record sets, arrays, and structures, back and forth between Flash MX and ColdFusion without having to assign them to a special scope or manipulate them in other ways?
This is where CFCs come in. CFCs provide the most natural and
integrated way to pass data between Flash MX and ColdFusion MX.
Components are nice because you can wrap multiple functions (methods)
inside a single file. With pages, each CFML file corresponds to a
single function. Also, unlike with ColdFusion pages, you do not need
to use the Flash scope when referencing arguments passed to the CFC
or return values to be sent back to the Flash MX movie. When a Flash
MX movie calls a method of a CFC, any arguments it passes to the CFC
are automatically available as named arguments in the
CFC’s arguments scope. Likewise, to return data from
the CFC method to the Flash movie, all you need to do is use the
cfreturn tag. The Flash Remoting gateway handles
everything else for you automatically.
CFCs offer additional advantages over the page approach. Whereas CFML pages tend to be specific to Flash applications (because ...