| By Ryan Moore | Article Rating: |
|
| May 22, 2006 11:15 AM EDT | Reads: |
17,229 |
As the World Wide Web's landscape has evolved from the days of multimedia-void static HMTL pages, the need for a dynamic interactive medium for Web applications has become apparent. Adobe Flash, as many developers know, is the most widely distributed, capable technology for achieving this new Internet medium. But Flash developers can't achieve the features expected from modern Web applications with Flash alone - for Flash's resources to be put to proper use, Flash must team up with a server-side technology capable of functionality such as database access and file manipulation. Microsoft's newest Web technology, ASP.NET, is a perfect counterpart for Flash, putting powerful capabilities at the fingertips of Flash developers, created using a programming language that is both friendly and familiar to ActionScript developers.
ASP.NET
ASP.NET, like other Web platforms such as PHP, JSP, and ColdFusion, is a set of Web development technologies that can be used to create Web applications and Web Services. ASP.NET is the next generation of Microsoft's Active Server Pages, a technology that was widely used to create Web applications in the 90s and early 2000s. ASP.NET represents not only the newest in Microsoft's Web technology arsenal, but also one of the most advanced Web development platforms currently available.
ASP.NET by itself is actually just a small part of a larger development framework created by Microsoft, known collectively as the .NET Framework. The .NET Framework is a software development platform that is used to build and deploy applications for a variety of uses, ranging from Web-based applications to Web Services to desktop-based applications. Although created by Microsoft, the .NET Framework is an Open Source standard, designed to be completely platform-independent, and therefore isn't restricted to execute on a Microsoft-based operating system.
The Open Source, platform-independent distribution of the .NET Framework is called Mono and is available at www.gomono.com. Among other things, the Mono Framework lets ASP.NET applications be deployed on non-Microsoft base Web servers, such as Linux or Sun. Languages like ASP.NET are typically referred to as "server-side" languages because, unlike Flash applications, which are displayed and execute in the Flash Player on a user's computer, server-side languages perform their magic on a Web server. Typically, server-side languages like ASP.NET are used to generate HTML documents that are sent to a browser for display. Server-side languages are used, for example, to generate all of the content you see on large-scale sites like www.amazon.com or www.cnn.com. When used in conjunction with Flash, however, ASP.NET is used instead to access and process information, package that information in a well-defined manner, and transmit that information to a Flash interface, which displays it for a user. Its ability to function in this role lets developers access the powerful functionality of ASP.NET without relying on HTML as a user interface. Instead, a rich interactive medium such as Flash can be employed, dramatically increasing the capabilities of Web-based applications.
Why Use ASP.NET for Flash Development?
Just because ASP.NET is one of the newest and most powerful server-side platforms available doesn't necessarily make it a good match for Flash developers. It's because some of ASP.NET's underlying features match up perfectly with the needs of Flash development that make it a perfect server-side comrade. And not only does ASP.NET provide all of the machinery necessary for Flash development, but it makes that machinery easy to operate, taking care of much of the underlying grunt work that other languages don't.
One of the foundations of the .NET Framework and ASP.NET is called the Framework Class Library (referred to as FCL). The FCL is a collection of reusable, commonly used objects. These objects let developers build on complex code that has already been created, eliminating the need to "reinvent the wheel" in your application. The Framework Class Library is very similar to the pre-built classes and components provided in Flash such as MovieClip, Button, and variable types such as String and Number. The libraries in FCL include tremendously powerful collections, such as ADO.NET - the .NET Framework's data access libraries - and ASP.NET - the libraries that give .NET the ability to create and distribute Web applications. Access to the FCL gives developers a major jumpstart in application development, allowing focus to reside on the higher-level design of the application and steer clear of unnecessary dirty work. For Flash developers specifically this means that you can spend more time on the Flash side of the application and less on server-side functionality.
One of the classes included in FCL that makes integrating with Flash a breeze is Web Services. Using ASP.NET, the creation of Web Services is a very painless process, since much of the underlying work is already contained in FCL. Web Services make it possible for developers to execute complex functions with an ASP.NET application and return complex results to a Flash application without having to create complicated data-formatting procedures.
Another reason that Flash developers will find ASP.NET a good match is the programming language commonly used to create ASP.NET applications, C#. C# (pronounced see sharp), is the newest language in the C family of languages. C# is a best-of-breed language combining the most popular features of C++, Java, and Visual Basic - which share the same foundations as ActionScript's foundation, JavaScript. Because C# and ActionScript have emerged from very similar models, their syntax is very similar, making for an easy transition between the two languages. Like ActionScript 2.0, C# is also a fully object-oriented language, which makes development very intuitive for an ActionScript programmer. I should mention that, although C# is the preferred language for creating ASP.NET applications, it's by no means the only one. Because of the flexibility of the .NET Framework, ASP.NET applications can be written in any ASP.NET compatible language, such as VB.NET and JScript (Java for .NET). This flexibility also makes the transition process easier for a developer who might already be familiar with one of these compatible programming languages.
What Types of Functionality Can ASP.NET Be Used For?
Although there are an infinite number of things that you can use ASP.NET to do, there are some powerful features that are commonly incorporated into Flash applications:
- Access stored data from a database: Using ASP.NET, it's possible to retrieve data from nearly any kind of database, including Microsoft SQL, MySQL, Access, and Oracle, to display in a Flash-based interface.
- Insert and update database data: ASP.NET can be used to update or insert data coming from a Flash interface into a database. Acting as the intermediary, ASP.NET can handle any database connectivity issues and respond accordingly.
- File uploads: File uploading is an essential feature of many Web-based applications. With Flash 8, Adobe released the ability to upload files from a user's file system directly to a Web server, monitoring the progress along the way. Using ASP.NET, it's possible for Flash to "hand off" the file to the Web server for proper placement.
- Image manipulation: Using ASP.NET, image files that exist on a Web server can be run through any number of manipulations, including resizing, cropping, and conversion. This can be a very useful feature when used in combination with Flash 8's advanced image processing techniques and user-uploaded image files.
- Security: ASP.NET is capable of many security-based functions that aren't available when using just Flash. FCL has advanced encryption and decryption algorithms built-in, making it easy for developers to do complex security techniques.
Another one of the strengths of ASP.NET for Flash developers is the preferred development environment used to create ASP.NET applications - Visual Studio.NET. Visual Studio.NET 2005 is one of the most advanced development environments in existence today. The features built into Visual Studio.NET not only help make ASP.NET development more effortless, but also help developers new to .NET programming learn these languages more easily.
In the past, Visual Studio.NET was not an affordable tool for many developers, with its various editions starting at around $1,000. However, with its 2005 product line, Microsoft has released a version of Visual Studio.NET called the Express Editions that is available free of charge until November 6, 2006. Specifically for Flash developers, the Visual Web Developer Edition is a perfect tool for beginning ASP.NET development, and is available for download at http://msdn.microsoft.com/vstudio/express/vwd/.
Methods Used for Flash-ASP.NET Interaction
When creating applications that make use of Flash and ASP.NET, a major obstacle can be the fact that they are two very separate systems - one executing on a client system, another on a Web server. Because of this separation, it's very important to understand the methods available to communicate between the two systems - without the proper communication channel, the two systems are useless to each other. As the Flash Player has evolved, so have many methods available to do this communicating.
FlashVars
FlashVars are a method of communicating between ASP.NET and Flash that uses tags embedded in HTML to exchange data. FlashVars only allow for one-way communication - from the server to the Flash Movie. Because of this, FlashVars aren't an alternative for applications that require data to be sent from a client-side application to a Web server, such as an e-mail form. FlashVars, however, are a very fast and efficient form of communication and are often overlooked in circumstances where small amounts of data have to be sent to a Flash Movie. (Figure 1)
FlashVars are unique among the exchange methods in that the data they contain is sent along with the .swf file when requested by a client browser instead of in a separate load after a Flash movie is loaded. This kind of exchange is less obtrusive to the user than other methods and is a good solution in certain circumstances.
LoadVars
The LoadVars object is much more versatile than FlashVars in terms of the direction and amount of data that can be exchanged. The LoadVars object is capable of either sending data to the server for processing, loading data from the server, or sending data to the server and waiting for a response back from the server in one operation. The LoadVars object uses name-value pairs to exchange data between the client and the server. The LoadVars object is best used in a scenario that requires two-way communication between the Flash Movie and server-side logic, but doesn't require large amounts of data to be passed. The LoadVars object requires that the .NET developer handle the formatting of the exchanged data - potentially a real pain, depending on the amount you intend to pass. (Figure 2)
XML Object
The Flash XML Object is another option for communicating between a Web server and Flash client. The XML object is very similar to the LoadVars object in functionality in that it can both send data to the Web server and get data from it. The difference between the XML object and the LoadVars object is the format in which the data being sent and received is formatted. Whereas the LoadVars object expects a name-value pair as a response, the XML object sends and receives a well-formatted structured XML document. Structured XML data makes the XML object much more suitable than the LoadVars object for handling larger amounts of data. (Figure 3)
Web Services
Introduced with Flash MX 2004 Processional Edition, Web Services are the newest method for communicating between Flash and ASP.NET. Web Services use SOAP (Simple Object Access Protocol), an XML-based format, to transfer data between the client and server. Web Services are an industry standard for exposing proprietary "services" for others to use in their applications. An example of a web Service is the search method offered by Google. By using this method through Web Services, it's possible for you to make a Flash application that uses the Google search engine. As mentioned earlier, Web Service creation is very easy with ASP.NET, making it an excellent choice for Flash applications. (Figure 4)
Flash Remoting for .NET
Flash Remoting is the most powerful and versatile of the options for communicating between a Flash movie and a .NET Web server. Using Flash Remoting, it's possible to access data directly from an ASP.NET Web application in a secure, quick, and efficient way. Flash Remoting uses a binary message format for transferring messages between the Flash client and server-side ASP.NET code called ActionScript Messaging Format, or AMF. AMF, like any of the other methods, travels between the client and server over HTTP, so you don't have to worry about security mechanisms (such as firewalls) interfering with your communication. Although modeled on the same protocol as Web Services, AMF is much more lightweight than the other communication options, and therefore travels much more quickly than calls using the Web Service connector. AMF is also securable using SSL, so it's a great option for security-sensitive applications. Using Adobe's version of Flash Remoting does come with a price tag, however. Flash Remoting for ASP.NET is a standalone server-side component not included with Flash MX 2004, which costs $999 per Web server. Thankfully, there's an Open Source alternative to the Adobe Flash Remoting for .NET package called Fluorine. Fluorine is an Open Source Flash (www.osflash.org) project and is available for download at http://fluorine.thesilentgroup.com/. (Figure 5)
Flash & ASP.NET Resources
The information I've covered in this article is just a brief overview of the world of Flash development with ASP.NET. I have recently written a book published by Friends of Ed called Foundation ASP.NET for Flash, which thoroughly covers all of the Flash-ASP.NET communication methods mentioned above, as well as a step-by-step introduction to ASP.NET development with C# and Visual Studio.NET. I encourage you to pick up a copy and add yourself to the growing community of Flash-ASP.NET developers. You'll also find a growing source of Flash and ASP.NET resources, as well as a support forum on the Foundation ASP.NET for Flash homepage at www.flashasp.net. (Figure 6)
Published May 22, 2006 Reads 17,229
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ryan Moore
Ryan Moore is the lead software architect and a principal of Balance Studios Inc. (www.balancestudios.com) as well as epicsoft, Inc. (www.epicsoft.net) of Green Bay, WI. Ryan is a C# programmer and Certified Macromedia Flash Developer. Ryan currently maintains a weblog at http://blogs.ittoolbox.com/c/engineering/
![]() |
Web Developer's & Designer's Journal 05/21/06 05:31:07 PM EDT | |||
As the World Wide Web's landscape has evolved from the days of multimedia-void static HMTL pages, the need for a dynamic interactive medium for Web applications has become apparent. Adobe Flash, as many developers know, is the most widely distributed, capable technology for achieving this new Internet medium. But Flash developers can't achieve the features expected from modern Web applications with Flash alone - for Flash's resources to be put to proper use, Flash must team up with a server-side technology capable of functionality such as database access and file manipulation. |
||||
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Executives Feature on Cloud Computing Expo Power Panel
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Reader Sued
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Ph.D. in Twitter Anyone?
- Adobe Flex Developer Earns $100K in New York City
- Eolas Sues the Internet
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Special Report on the Emerging Cloud Computing Trend
- My Thoughts on Ulitzer
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Ulitzer Live! New Media Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Executives Feature on Cloud Computing Expo Power Panel
- Software Flexibility in the Cloud - Part 4 of 5
- Is Microsoft as Free as Open Source?
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Reader Sued
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Where Are RIA Technologies Headed in 2008?
- Cover Story: How to Increase the Frame Rates of Your Flash Movies
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Your First Adobe Flex Application with a ColdFusion Backend
- Adobe Flex 2: Advanced DataGrid
- i-Technology Blog: Death-Knell For "Rich Media? Hardly!
- Adobe/Macromedia - Microsoft, Look Out!
- How To Create a Photo Slide Show ...
- Adobe Flex Interface Customization - Themes, Styles, Skins
- Personal Branding Checklist
- Has the Technology Bounceback Begun?
- "Real-World Flex" by Adobe's Christophe Coenraets



































