6 Adobe AIR ActionScript APIs explored, first up File System Access
Ted Patrick recently visited San Diego and gave a presentation for the upcoming release of Flex Builder 3.0 and AIR 1.0. One thing that
stood out was the slideshow that Ted used during his presentation. One important screen that jumped out at me was the Adobe AIR Application Stack. The 6 Adobe AIR APIs in this diagram seemed like they would make a good blog series. Here are the APIs from the slide:
- File System Access
- Network Detection
- Notifications
- Application Update
- Drag and Drop
- Local Database
The first code example is for File System Access. The next code example will be Network Detection.
Here is the source code that is used to open and read a .txt file with Adobe AIR. Note: this is a simple example created using the “Developing AIR Applications with Adobe Flex 3″ online manual. This manual is a GREAT resource and I highly recommend using it.
Adobe AIR: File System Access
Example Code:
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="init();">
<mx:Script>
<![CDATA[
private var file : File;
private var fileStream : FileStream;
private var fileContents : String;
private const ISO_CS : String = "iso-8859-1";
private function init() : void
{
file = new File();
file = File.applicationDirectory.resolvePath("file.txt");
fileStream = new FileStream();
fileStream.addEventListener( Event.COMPLETE, fileComplete );
fileStream.openAsync( file, FileMode.READ );
}
private function fileComplete( event : Event ):void
{
fileContents = fileStream.readMultiByte( fileStream.bytesAvailable, ISO_CS );
trace( "fileContents="+fileContents );
}
]]>
</mx:Script>
</mx:WindowedApplication>
flickr
brightkite
[...] 6 Adobe AIR ActionScript APIs explored, first up File System Access – seantheflashguy.com [...]
[...] 6 Adobe AIR ActionScript APIs explored, first up File System Access – seantheflashguy.com [...]
[...] 6 Adobe AIR ActionScript APIs explored, first up File System Access – seantheflashguy.com [...]
[...] 6 Adobe AIR ActionScript APIs explored, first up File System Access – seantheflashguy.com [...]
[...] http://seantheflashguy.com/blog/2008/01/28/6-adobe-air-actionscript-apis-explored-with-example-code/ [...]
Hello,
am new to Flex and and for AIR also.I wanted to know how you have implemented these applications using Action Script,MXML and AIR, where can i find the source code for the above 6 applications.
I think you will help me.
Thanks,
sankar