Download presentation
Presentation is loading. Please wait.
Published byEzra Byrd Modified over 9 years ago
1
www.cfunited.com AIR: Building Desktop Applications with Flex Rob Rusher
2
2www.cfunited.com About Rob Rusher Principal Consultant at On3 Former Macromedia Professional Services Working with Flex from the beginning Working with AIR from the beginning Wrote the Adobe Certified AIR course Author of a few ColdFusion books Purveyor of knowledge
3
3www.cfunited.com About this session What AIR gives you How to create an AIR application with Flex How to implement several AIR features
4
4www.cfunited.com What AIR gives you Runtime (required on the client) Version of Flash Player WebKit SQLite SDK Component Library AIR Developer Tool (ADT) AIR Debug Launcher (ADL)
5
5www.cfunited.com More on the AIR SDK Extension to Flex API File system access Network access Embedded database Drag-n-Drop Windowing Application Update Also a JavaScript version of the API
6
6www.cfunited.com How to Create an AIR Application
7
7www.cfunited.com What did that do? Application Descriptor Required XML file Uniquely identifies your application via an Application ID com.on3solutions.myapplication Version Application Icons Initial window
8
8www.cfunited.com A look at the Application Descriptor com.on3solutions.feedreader Main v1 --> [This value will be overwritten by Flash Builder in the output app.xml] -->
9
9www.cfunited.com Lets implement these features File FileStream NativeWindow HTML SQLite
10
10www.cfunited.com FileFile A flash.filesystem.File object represents either a file or directory Some File methods have synchronous and asynchronous versions: –copyTo() and copyToAsync() –deleteFile() and deleteFileAsync() –moveTo() and moveToAsync() Synchronous method calls suspend execution Asynchronous method calls do not suspend code execution, but require an event listener
11
11www.cfunited.com Common directories
12
12www.cfunited.com Files on your system Additional methods to open a system dialog with a specified title, and optionally filter by an array of permitted types browseForDirectory( title ) browseForOpen( title, typeFilter ) browseForOpenMultiple( title, typeFilter )
13
13www.cfunited.com DisclaimerDisclaimer YOU are the ONLY one responsible for deleting files that shouldn’t be deleted.
14
14www.cfunited.com Deleting files Methods to recycle or delete a file’s path content deleteFile() deleteDirectory( deleteContent ) private function deleteFile( evtObj:Event, tree:FileSystemTree ):void { if( tree.selectedItem.isDirectory ) { tree.selectedItem.deleteDirectory(true); } else { tree.selectedItem.deleteFile(); } }
15
15www.cfunited.com FileStreamFileStream A flash.filesystem.FileStream object is used to read or write files to the file system Again, files may be opened and written synchronous or asynchronous PROGRESS and COMPLETE events are dispatched during read/write
16
16www.cfunited.com Using a FileStream Create a FileStream object Create File objects for the directory and file to read or write Open the file stream for synchronous or asynchronous Read or write data to the file stream –readBytes(), readUTF(), readObject(), etc. –writeBytes(), writeUTF(), writeObject(), etc. Close the file stream–close()
17
17www.cfunited.com WindowingWindowing NativeWindow mx:WindowedApplication, mx:Window HTMLLoader.createRootWindow, window.open()
18
18www.cfunited.com mx:HTMLmx:HTML Used to load HTML content within an AS application HTML text provided by the app has full system access Can eval() HTML text loaded from an external URL (including OS files) is loaded with limited security
19
19www.cfunited.com Drag and Drop Supported Types Bitmaps Files Text URL Strings Serialized Objects (AMF) Operations Copy Move Link
20
20www.cfunited.com NativeDrag classes NativeDragManager NativeDragEvent Clipboard reference Clipboard hasFormat() get/set/clearData()
21
21www.cfunited.com Persisting application data Embedded SQLite engine Supports AES-CBC 128-bit encryption Stores byte arrays indexed by a string key setItem, getItem, removeItem
22
22www.cfunited.com SQL Classes SQLConnection SQLStatement Synchronous and Asynchronous methods
23
23www.cfunited.com SQL Syntax Parameters :param @param ? Numbered params, 0-indexed
24
24www.cfunited.com Updating Applications ApplicationUpdater Use version tag in app-descriptor Migration isFirstRun isNewerVersionFunction
25
25www.cfunited.com Contact Info On3solutions.com rob@on3solutions.com http://www.robrusher.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.