Welcome!

Adobe Flex Authors: Maureen O'Gara, Liz McMillan, RealWire News Distribution, Yakov Fain, Keith Swenson

Related Topics: Adobe Flex, Java, ColdFusion, AJAX & REA

Adobe Flex: Article

How I Saved Some Money With A Flex 2 DVD Library Application

Now there is simply no excuse for accidentally buying a DVD I already own

I have been collecting DVD movies for years now and, on some occasions, I have forgotten that I already owned a particular movie. More times than I hate to admit, I have ended up with two copies.

At my wife and budget's insistence, I created a Flex 2 application with a ColdFusion, CFC-based back end that allows me to store a DVD inventory with the expected data inputs (see Figure 1) into a mySQL database. This Flex 2 application displays the inventory in a DataGrid (see Figure 2) with an itemRenderer that displays the DVD cover art, and it utilizes an Amazon Web service (http://labs.insideflex.com/flextraining/movies/bin/ExampleAWSCall.xml) to dynamically locate the URL of a medium-sized image of the cover. In addition, a back-end CFC function automatically calls the YouTube API to grab the URL of a trailer for the movie, based on the title entered (see Figure 3).

Let's take a peek at the MXML code (see Listing 1). First, the database is a simple table (no normalization was used, but that certainly could be added). The movies table structure (http://labs.insideflex.com/flextraining/movies/bin/movies.sql.txt) is shown in Figure 4. Next, I used the Flex Builder 2's ColdFusion CFC Value Object Wizard to quickly create the server-side components from the database structure. Three CFCs and one ActionScript class later, the back end was complete (see Listing 2). The creationComplete event, in the dvdLibrary.mxml, calls a function, pageLoaded(), that triggers a RemoteObject call to the movieGateway component's getAllAsQuery() function. The returned data is pushed into a Bindable ArrayCollection, arcMovies, which serves as the dataProvider for the DataGrid, dgMovies. ItemRenderers are used to format the cells of the DataGrid, including a CoverRenderer to display the cover art for the DVD's Image data (this data is provided by the Amazon Web service (1)). In addition, a call to a YouTube (2) Web service supplies a movie trailer for each DVD added to the library. Adding a new DVD has only one required field - the DVD's title. The mx.events.ValidationResultEvent and mx:StringValidator are used to ensure that a title is entered (3). The title is passed to both of the Web services and saved to the database. A TitleWindow (4) is utilized to display a larger image of the cover artwork as well as to display the movie trailer.

Building this project was fun as well as useful. The full source code is available at http://labs.insideflex.com/flextraining/movies/bin/srcview/index.html.

Now there is simply no excuse for accidentally buying a DVD I already own. I will soon be entering my entire collection of DVDs into this new Flex 2 DVD library. From now on, I plan to check this library before heading out to the video store. For the final online version of this Web application (http://labs.insideflex.com/flextraining/movies/bin/dvdLibrary.html), I've added search functionality so that as the library grows, it will still be easy to filter out and find the movies. I already have plans to port this Flex Web application to an Apollo desktop application in the coming weeks. If you would like to keep an eye on my progress, please visit my blog, www.flexination.info, when you have time. If you have any follow-up questions, feel free to ping me at the e-mail address listed with the article.

More Stories By Michael Givens

Mike Givens is the CTO of U Saw It Enterprises, a Web technology consulting firm based in Marietta, GA. He is an Adobe Corporate Champion known to share his experience and evangelism of all things Adobe. Certified in both ColdFusion 5 and as an Advanced CFMX Developer, he has been using ColdFusion since the days of Allaire Spectra. For the last 11 years, he has been seen with his head down - deep in the code.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
realgeorge39 09/11/07 06:27:13 AM EDT

dvdXsoft DVD to Zune Converter can convert video DVD to MP4 Video files suitable for Zune, PSP or iPod devices! This software is the best for converting DVD to MP4 files in speed and compatibility.

zuneconverter.net/dvd-to-zune

barrett63 09/03/07 03:35:01 AM EDT

SecondLife DVD Maker is a powerful and easy-to-use DVD Author and Burning tools . You can make your own DVD title with the movie captured by your DV or downloaded from the internet.

http://www.vista-download.net/audio-video/dvd-software/