Using Flash MX ActionScript
Beyond Flash MX
Communication Outside of Flash MX
Flash MX can communicate with the outside world, which make it even more dynamic.
Bhangal write that using the following commands are how you can accomplish
communication outside of Flash MX (p. 420-421, 2002):
getURL() – This is one of the simplest and most commonly used methods
of reaching outside of Flash. Essentially, what getURL() does is send an HTTP
request to the browser. This means that we can make Flash open up other web
The getURL() command doesn’t actually return any data as such – it
simply sends out HTTP requests.
loadVariables() – Although loadVariables() is an old Flash 5 function,
it’s still highly useful today. With the loadVariables() command, we
can call a web page, script, or text file, and retrieve data from it. The data
comes back in a format that Flash can read, and we can use that data as variables.
The data is sent in a format known as name/value pairs. A string of data in
the name/value pair format might look something like this: variable1=data&variable2=moreData&variable3=lostOfData&… Each
name/value pair is separated by an ampersand (&). This data could be stored
in a text file, or generated dynamically by a server script. Once a loadVariables()
function is issued, the server responds and then the connection is closed.
The LoadVars object – This is similar to loadVariables(), except that
everything is neatly contained within an object, which allows for easy transmission
and receipt of data. The LoadVars object has a number of associated send and
receive methods, and data is also transmitted in name/value pairs. Once the
send and response is complete, the connection is closed.
The XML object – This object is similar to the LoadVars object, except
it sends and receives its data formatted as an XML document rather than in
name/value pairs. When an XML document is loaded, the connection is closed.
The XMLSocket Object – This object differs from the other data retrieval
formats because once an XMLSocket Connection has been established, the connection
remains open, and any data can flow freely back and forth between server and
Flash movie. Generally XML formatted data is sent across, but the XMLSocket
object can actually transmit any format of data, as long as our Flash movie
knows how to interpret and respond to it.
Flash MX, ColdFusion, and Flash Remoting
Flash MX offers many ways for programmers to connect clients with data and
logic living on application servers. Through Flash Remoting, Flash MX can talk
directly to application servers, such as ColdFusion, as though they were local
to the client. Flash Remoting takes care of data-type conversion, object lifetime
management, serialization, and other details of client-server communications.
Flash Remoting allows the programmer to pass data easily while also implementing
a way to create reusable components on the server-side too. Baldwin states
that Flash Remoting transfers data between Flash and the server via the Action
Message Format (AFM). AFM is transferred over HTTP and provides a more effective
and efficient means of communication (p. 18, 2002). Flash Remoting enables
tight integration between Flash MX and ColdFusion MX, and makes the programmer’s
job easier. Flash Remoting brings the gap between the rich-client development
capabilities of Flash MX and the growing wealth of enterprise data and functionality
residing on application servers, like ColdFusion. Kollmeyer offers the following
possibilities for using Flash Remoting, Flash MX, and ColdFusion (or another
application server, such as .NET) (at http://www.blueedgedata.com/flash/flashremoting.htm,
- Local data storage for your application, for example, being able to save
a quote that you have created locally
- Building solid database applications, including rich user interface elements,
such as robust, event driven controls, lists, multiple windows, drag and drop
and many more
- Integrated on-line help, with streaming audio and video
- True, interactive, graphical interfaces, including creating images and objects
that the user can manipulate
- Real-time collaborative applications, including multi-user drawing, live
video, remote control and many more
- Running “outside the browser” and off-line through the Flash
- True printing capabilities, such as printing documents that are different
from what is currently seen on the screen
- Minimal deployment concerns
- Integrate with your existing databases, web services, and .NET applications
- Running the same system on various platforms with no or minimal changes,
including the iPAQ and the wireless Nokia 9200 cell phone / PDA combination
- Full programming language, with complete component architecture that is
easily created for your own reusable components
- Small, download of the runtime environment because an earlier version of
Flash is probably already installed on your users’ computers
If you go to http://www.beyondflash.com/content/index.htm, you can learn more about other ways to go beyond Flash MX.