Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Adobe AIR Developer Center /

Easy Library: An Adobe AIR library management system

by Rajesh Kumar

Rajesh Kumar
  • connectusers.com

Content

Created

19 March 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
ActionScript Adobe AIR CRUD database SQLite

Requirements

Prerequisite knowledge

Knowledge of ActionScript will help you make the most of this article.

User level

Intermediate

Required products

  • Adobe AIR

Sample files

  • easy-library-source.zip

Easy Library is a complete library management system built using Adobe AIR.

Though it is certainly possible to develop this type of application in various languages and for a variety of deployment platforms, using AIR can reduce the effort needed to deliver a complete system with full database connectivity and a rich user interface.

Easy Library can be used by library staff to manage library operations, including issuing (loaning) books, returning books, checking issue history, querying books due for return, and more. This application can be used in companies or college libraries for managing books and the transactions common to library operations.

A working version of the application and its source code are included in the sample files for this article.  Throughout the article I refer to the specific methods within the source code that implement the main features of the application.

How the application works

Easy Library users are managed via an XML file named Users.xml.  This file defines all users, as well as their passwords and access levels.

Users.xml

<?xml version="1.0" encoding="UTF-8"?> <users> <user name="Rajesh Kumar" username="rajesh" password="adobe" role="administrator" /> <user name="Temp User" username="tempuser" password="adobe" role="user" /> </users>

To gain access to Easy Library, users must first authenticate via the login screen (see Figure 1).

Figure 1. The Easy Library login screen
Figure 1. The Easy Library login screen

After login, the user is directed to the dashboard view, which shows all the overdue issued books (see Figure 2).

This functionality for the dashboard view is supported by three key methods:

protected function LogIn_clickHandler(event:MouseEvent):void{ ... //authenticate the user and directs the user to dashboard. } private function dashboard_handlerCount():void{ ..//launches the dashboard with required data } protected function populateDashboardCountGrid(event:SQLEvent):void{ ..//populate the dashboard with not available books whose returned date has already passed. }
Figure 2. The main dashboard
Figure 2. The main dashboard

Issuing a book

To issue a book, the user will need to complete the following steps:

  1. Click the Issue A Book tab.
  2. Type the book’s Code Name (see Figure 3). (Each book is associated with a unique Code Name when it is added to the library.)
  3. Press Enter. The application will populate the remaining fields with the book details. This is handled by the following method:
protected function bookCodeName_enterHandler(event:FlexEvent):void{ ..//fetches the book details and populates the field }
  1. Type the name of the employee to whom the book is being issued, along with the employee ID, email address, date of return, and other optional details.
  2. Click Issue The Book.
Figure 3. Issuing a book
Figure 3. Issuing a book

The book is immediately added to the list of issued books (see Figure 4). This is handled by issueBookEntry:

private function issueBookEntry(event:MouseEvent):void{ ...//issue the book to the employee, insert a new entry in the table, and set the book’s availability as false. }

If the user made a mistake while issuing the book, he or she may click the red X in the last column to delete the entry and create it again.  Check deleteBookTransaction in the source code to see how this is done:

public function deleteBookTransaction(event:MouseEvent):void{ ..//delete the entry if a mistake was made and user wants to reissue }
Figure 4. The issued book is added to the list.
Figure 4. The issued book is added to the list.

Adding a book

To add a book, an administrator must complete the following steps:

  1. Click the Add A Book tab.
  2. Type the book’s Name and Code Name, and fill in additional details such as author, owner, price, and date of purchase.
  3. Click Add The Book.

The addBookEntry method is responsible for adding the book to the database:

protected function addBookEntry(event:MouseEvent):void{ ..//Adds the new book on purchase. }

Returning a book

When a book is returned, the librarian can follow these steps to check it back in:

  1. Click the Return Book tab.
  2. Search for the issued book using the Book Code, book name, employee, employee’s email, or issuer.
  3. Click on the check mark (see Figure 5) to indicate the book is again available to be issued.
Figure 5. Returning a book
Figure 5. Returning a book

This is handled by the returnBook_clickHandler event handler:

private function returnBook_clickHandler(event):void{ ..//when a book is returned and the book is now available for issue }

Searching, updating, browsing, and querying

To update an issued entry, the user can:

  1. Click the Search tab.
  2. Search for the entry using any of the available attributes.
  3. Click the field in the data grid that is to be updated and make the changes (see Figure 6).
Figure 6. Updating a database entry
Figure 6. Updating a database entry

This functionality is handled by the following two methods:

protected function search_clickHandler(event:MouseEvent):void{ ...//search for the entry } public function updateTransaction(event:MouseEvent):void{ ...//updates the entry if any changes is made after searching. }

To see all issued books (which are not available for issue), click the All Issued Books tab.To see all books in the database click the Display All Books tab.  This feature is implemented by the following method:

private function getAllBookResult():void{ ...//fetch all the books from database }

You can also submit a custom query using the Your Query tab. To see the code, explore the query_clickHandler method:

protected function query_clickHandler(event:MouseEvent):void{ ..//executes the query directly }

When issuing your queries, keep in mind the book issue table is named libraryTableNew and the book repository table is named bookTable.

Easy Library uses a SQLite database, and connects using the code below:

public function openDatabaseConnection():void{ // create new sqlConnection sqlConnection = new SQLConnection(); sqlConnection.addEventListener(SQLEvent.OPEN, onDatabaseOpen);// get currently dir var dbFile:File = File.applicationStorageDirectory.resolvePath("library.db"); // open database,If the file doesn't exist yet, it will be created sqlConnection.openAsync(dbFile); } // connect and init database/table private function onDatabaseOpen(event:SQLEvent):void { try { var sqlStat:SQLStatement; sqlStat = new SQLStatement(); sqlStat.sqlConnection = sqlConnection;; var sql:String = "CREATE TABLE IF NOT EXISTS "+dbTableName+"(" + ……………. "status TEXT"+ ")"; sqlStat.text = sql; sqlStat.addEventListener(SQLEvent.RESULT, statResult); sqlStat.addEventListener(SQLErrorEvent.ERROR, statFault);sqlStat.execute(); } catch (error:SQLError) { Alert.show(error.details, "Error"); } }

Where to go from here

In its initial version,Easy Library uses a local database (SQLite), but it can be integrated with an external database to use  more extensive library data. Other input devicessuch as a barcode readeror access card can also be used with the application to reduce manual steps.  I encourage you to explore the source code for the application to better understand how all the methods work.

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • What's new in Adobe AIR 3
  • Developing cross-platform Adobe AIR applications
  • 10 common mistakes when building Adobe AIR applications
  • Tips for building AIR applications that can be easily updated
  • Adobe AIR and the experience brand
  • Uploading images from CameraRoll and CameraUI
  • Getting started with Adobe AIR for Flex and ActionScript 3 developers
  • Ten tips for building better Adobe AIR applications
  • Deploying Adobe AIR applications seamlessly with badge install
  • Using the Adobe AIR update framework

Tutorials and samples

Tutorials

  • Using the iOS Simulator to test and debug AIR applications
  • Using the Amazon In-App Purchase Adobe AIR native extension for Android and Kindle Fire
  • Transferring data with AIR native extensions for iOS – Part 3
  • Exchanging Vector and Array objects between ActionScript 3 and C, C++, or Objective-C

Samples

  • Licensing Adobe AIR applications on Android
  • Using web fonts with Adobe AIR 2.5
  • Using Badger for Adobe AIR applications

AIR blogs

More
07/09/2012 Protected: Publishing Adobe AIR 3.0 for TV on Reference Devices
07/08/2012 Source Code: Adobe AIR 3.3 Retina Video Application
07/06/2012 Application specific File Storage on Adobe AIR based ios Application
07/04/2012 Recent Work - iPad/Android App: Inside My toyota

AIR Cookbooks

More
02/09/2012 Using Camera with a MediaContainer instead of VideoDisplay
01/20/2012 Skinnable Transform Tool
01/18/2012 Recording webcam video & audio in a flv file on local drive
12/12/2011 Date calculations using 'out-of-the-box' functions

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement