navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

AIR Essential Training (2008)

AIR Essential Training (2008)

with David Gassner

 


In AIR Essential Training, instructor David Gassner shows how to use the Adobe Integrated Runtime (AIR) and associated development tools to create dynamic applications. David demonstrates how to build and deploy desktop applications that run equally well on Windows and Mac OS X. He covers creating applications in Flex Builder 3, Dreamweaver CS3, and Flash CS3; working with HTML and PDF documents; creating a seamless installation experience; and more. Exercise files accompany the course.
Topics include:
  • Getting started with AIR
  • Using the AIR SDK
  • Creating AIR applications in Flex Builder 3, Dreamweaver CS3, and Flash CS3
  • Setting application properties
  • Working with PDFs
  • Creating applications with transparency
  • Using file system input and output
  • Distributing applications

show more

author
David Gassner
subject
Developer, Desktop Apps
software
AIR 1
level
Beginner
duration
4h 17m
released
Feb 24, 2008

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:00Hi, my name is David Gassner, and I'd like to welcome you to this AIR 1.0 Essential Training video series from lynda.com.
00:07AIR, the Adobe integrated runtime from Adobe Systems, has been in development for the last couple of years
00:13and with this 1.0 release of the product, developers will now be able to build cross-platform applications,
00:19leveraging their existing skills in HTML, Flash and Flex, and deploy them on both Mac and Windows operating systems.
00:27The primary goal of this series is to get you acquainted with the product and to show you the options and capabilities
00:32and to show you what it feels like to develop in the different environments.
00:36The AIR STK, Flex Builder, Dreamweaver and Flash.
00:41In the video series that lynda.com is publishing,
00:43you'll be able to dive deeper into these technologies focusing on your development platform.
00:48For instance, one of the follow up video series will be totally focused on Flex, allowing Flex developers to dive deeper
00:55into this technology and see what kind of applications they can create.
00:58Similarly for Flash and HTML developers.
01:01You can select a video series that's dedicated to the way you develop applications.
01:06So I hope this training is helpful and that you learn a lot about what the Adobe integrated runtime is and how you
01:12use it to build these cross operating system applications.
Collapse this transcript
Setting up the exercise files
00:00If you're a premium member of the lynda.com Online Training Library
00:04or if you are watching this tutorial on a disk, you have access to the exercise files used throughout this title.
00:09The exercise files are delivered in a ZIP or an archive file
00:13that can be extracted and used on either Windows or Mac OS X.
00:17You can extract these exercise files anywhere on disk. For instance, if you're working on Windows, you might install them
00:23right into the C drive root.
00:24Or if you're working on a Mac, you might create them in a folder under your user directory.
00:28You can extract these files using either your operating system capabilities or a ZIP utility.
00:34I'm working on Windows Vista
00:35so I'll double-click the .ZIP file to open it up
00:38and you'll see that it contains a single folder called AIR Essential Training.
00:42I'm going to extract this file by simply copying and pasting and again, the technique you use to extract will differ
00:48depending on how you work with ZIP files.
00:51I'll open a copy of Windows Explorer and navigate to the C drive root.
00:55If you're working on Mac OS X, you might navigate instead to your documents folder
00:59and then drag and drop the AIR Essential Training folder from the ZIP area over to where you want to install it.
01:05And that will result in copying the files from the ZIP file into where you want use them.
01:11Throughout the demonstrations in this video series I'll be referring to the exercise files area or exercise files folder.
01:18I'll always be referring to this AIR Essential Training folder, where ever you install it on your system.
01:25The exercise files are structured like this.
01:28There's an Assets folder that contains the various graphics, PDF files, text files and icons.
01:34If you follow along in the exercise files,
01:36you need some of these assets during various demonstrations and exercises.
01:40There are three folders labeled Flash, Flex and HTML,
01:44which are your exercise areas for these different technologies.
01:48There's a Projects folder which contains ZIP files and folders for use in getting started with various applications.
01:54Some of the ZIP files there are Flex project archives.
01:58When you have to deal with those, I'll describe how to deal with them in the exercise videos.
02:03And then finally there's a Solutions folder which contains the final version of all the code, once again separated by
02:09the different technologies, Flash, Flex and HTML.
02:13So that's how you install the exercise files and how they're structured.
02:16And now you should be ready to get started learning all about the Adobe integrated runtime or AIR 1.0.
Collapse this transcript
Understanding the prerequisites
00:00This video training series, AIR 1.0 Essential Training, is designed for developers who have pre-existing skills
00:06in building applications that are delivered over the web,
00:09and now want to leverage the skills to build desktop applications delivered with AIR.
00:14I won't be talking a lot about how to build applications in Flex, Flash or HTML throughout this video series.
00:20For instance, for a Flex developer, anything you can do in Flex, you can do in an AIR application built in Flex
00:26and the same thing is true for Flash and HTML.
00:28Instead, the focus of this video series is on how to take those web-based applications or web-based interfaces and
00:35deploy them in AIR and also how to use the added features of the AIR libraries that allow you to do things in
00:41AIR applications that you can't do in web applications.
00:44You'll need certain software to work through some of these exercises.
00:48For instance for Flex, you'll need Flex Builder 3.
00:51The release of Flex Builder 3 is synchronized with the release of AIR 1. 0,
00:55so you'll be able to get Flex Builder 3 from Adobe at the same time as AIR is available.
01:00For HTML, I'll be working primarily in Dreamweaver CS3.
01:04Although if you're an HTML developer who uses some other developer tool,
01:08you'll be able to work through any of those exercises using a combination of your HTML development tool plus
01:14the AIR software developers kit.
01:16For Flash, you'll need Flash CS3 Professional
01:19and you'll need to update that product as I'll describe in the videos in that section with updaters from Adobe,
01:25both to bring it up to speed to the latest maintenance release
01:28and to install the specific tools for Flash and AIR application development.
01:33For additional information about building applications in Flex, Dreamweaver or Flash,
01:38check out some of the video titles from lynda.com that are specifically designed to teach you about those technologies.
Collapse this transcript
1. Getting Started
Understanding Adobe Integrated Runtime (AIR)
00:00In this video, and I'm going to describe the basic nature of the Adobe integrated runtime, or AIR, and some of its benefits.
00:07The Adobe integrated runtime, now known as AIR, used to be known as Apollo.
00:12It is a product that's been in development by Adobe Systems for a couple of years now.
00:16And this process has included in number of public betas, which has allowed the developer community to become accustomed to
00:21building desktop applications using traditional Web style architectures.
00:26The Adobe integrated runtime includes two major aspects.
00:30First the runtime itself.
00:32The runtime is installed as software on a number of different operating systems,
00:36and it supports the installation and running of desktop applications that are built in the Flex, Flash and HTML architectures.
00:44Second, there's a whole set of development tools that are provided by Adobe for building these applications.
00:49Some of these development tools are free and some of them are incorporated into existing commercial tools such as Flex Builder, Flash and Dreamweaver.
00:58AIR applications can be installed and run on a number of different operating systems.
01:03These include Windows XP SP2 and Windows Vista, including all editions, such as Home, Business and Ultimate,
01:11and on a Macintosh, these applications can be installed on the latest versions of the Mac OS X operating system,
01:17including both Tiger version 10.4 and Leopard 10.5.
01:21Also there's complete support for both the older PowerPC and the newer Intel-based Macs.
01:27AIR applications can also be installed on the older Windows 2000 operating system, but not all of the installation features are supported.
01:34Specifically, there's a feature known as a seamless install, which means the user can install the runtime and the application at the same time.
01:42That features is not supported on Windows 2000,
01:44but users can install the runtime separately and then install applications as separate processes.
01:51Support for the Linux operating system is scheduled for future release by Adobe Systems,
01:55but Adobe hasn't promised a particular date for delivery of this support.
02:00Here are some of the benefits of the Adobe integrated runtime.
02:03First, rapid application development.
02:05All of the platforms and languages you use in building AIR applications have existed for quite a while and are
02:10completely documented and there's a lot of support out there both from Adobe and from third parties.
02:16For instance, if you're Flex developer you'll be working with XML and ActionScript 3.
02:20If you're Flash developer, you'll be working with ActionScript as well.
02:24And if you're an HTML developer, you'll be working with HTML, cascading style sheets and JavaScript.
02:29The bottom line is that there aren't new languages to learn so much as new techniques and packaging them and leveraging the capabilities of the runtime.
02:38The different development platforms that you'll use.
02:41If you're a Flex developer, you'll want to upgrade to the latest person to Flex, version 3. 0.
02:46As with Flex 2, you'll be working with the languages XML and ActionScript 3.
02:50If you use Flex Builder, you'll have a new version of Flex Builder that has integrated support for the building and deploying of these applications.
02:57For Flash developers you'll want to be working in the latest version of the product version CS3 and working with the language ActionScript 3.
03:05In a later video I'll describe the requirements for working in Flash, including which version of the Flash authoring environment you need,
03:12and how to get the plug-in that allows to build and deploy applications from directly within Flash.
03:17For HTML developers, you can work in HTML, cascading style sheets and JavaScript.
03:22If you know how to program using Ajax style development, or asynchronous JavaScript and XML, you'll be able to leverage
03:29these techniques to make calls to Web services from within your HTML-based content.
03:33And if you're a Dreamweaver developer there's an extension you can download and install from Adobe for free that
03:38upgrades Dreamweaver CS3 to allow you once again to build these applications and deploy them from directly within your development tool.
03:46Here are some of the benefits of the Adobe integrated runtime.
03:49First of all, you have access to complete Web services, including rest-based services, meaning XML that you retrieve from a Web server at runtime.
03:57SOAP-based Web services that leverage the SOAP protocol and Flash remoting-based services.
04:03Examples of application servers that support the Flash remoting architecture include Cold Fusion,
04:09Blaze DS and Live Cycle data services from Adobe for Java developers,
04:13the open source product Florine and the commercial product WebOrb for ASP.net developers, and OpenAMF for PHP and Java developers.
04:22You can select any of these applications servers to integrate with your AIR applications at runtime.
04:27Now in the next set of videos I'll talk about some of the development tools that you can select to build your AIR applications,
04:33and I'll give you an overview of AIR security, how you apply security models to both the AIR installation process and to running applications at runtime.
Collapse this transcript
Using development tools for building AIR applications
00:00In this video I'm going to describe the different software development tools that you can select from to build, compile
00:06and deploy your AIR applications.
00:08First the AIR software developers kit or the SDK.
00:12This is a set of command line tools that you can download and install from Adobe Systems. It is completely free.
00:18There are no license fees or royalties that you have to pay to Adobe and the applications that you build with the SDK can be deployed freely,
00:24and the applications that you build with the SDK can be based on a combination of Flash and HTML content.
00:31First for Flex developers, there's a command line compiler called amxmlc.
00:37This is analogous to the MXML C command line compiler that's a part of the Flex SDK.
00:42You take your MXML and ActionScript 3 assets,
00:45and you build Flash-based content using this command line compiler.
00:49There's also command line compiler called acompc,
00:52which is analogous to the Flex compc command line compiler, which can be used to build both components and component libraries.
00:59There's a debug launcher in the SDK that you can use to debug and test your applications,
01:04and then the critical piece of the SDK is the AIR developer tool or the ADT.
01:09The purpose of the ADT is twofold.
01:11First of all, its main purpose is to export complete installation files.
01:16An AIR installation file has .air or AIR file extension and it's built using the ADT tool.
01:23In order to build an AIR application, you take your Flash and HTML formatted content,
01:29you combine that with something called an application descriptor file that I'll describe in detail in later videos,
01:34and from the there you can build the AIR install file.
01:37The ADT also knows how to create something called a self-signed security certificate.
01:42I'll talk about the nature of that in the next video.
01:45Typically you'll get a security certificate from one of the main security vendors, Thawte or VeriSign for instance,
01:50but if you're building an application for internal use or just for testing the ADT allows you to build lower level
01:56security certificates that don't require a purchase from a security vendor.
02:01Finally, integration with the Apache ANT package is supported and documented.
02:05For developers to know how to use Apache ANT to automate their build processes,
02:09this allows you to integrate the AIR command line tools into the ANT processes and make sure that you're building consistently and reliably.
02:17In addition to the SDK, Adobe is also delivering a set of commercial development tools.
02:22For Flex developers, a new version of Flex Builder has been delivered, Flex Builder 3, that includes integrated
02:28support for building and deploying Flex-based AIR applications.
02:31When you create a new Flex project in Flex Builder 3, you now have a choice between creating a web-based project or a desktop project.
02:39And when you create the desktop version, you'll be building an AIR application.
02:43All of the command line tools that are available in the SDK are also integrated into Flex Builder 3.
02:48And if you have Flex Builder it makes it a lot easier to build and deploy these applications.
02:54For Flash developers there's an upgrade to version 9.02 that you'll need. That's a free upgrade to the existing Flash CS3
03:01package, so if you already have a Flash CS3 license, you won't need to purchase anything else from Adobe.
03:07And then there's an additional patch that needs to be installed that adds commands to the Flash authoring environment,
03:12to support creating and deploying Flash-based AIR applications directly from within that environment.
03:19If you use Dreamweaver to build HTML-based content, you'll want to go get the Dreamweaver AIR extension for Dreamweaver CS3.
03:26Once again you have to have a Dreamweaver CS3 license to use this tool but if you already have that license,
03:31the extension that adds AIR functionality to Dreamweaver again is free.
03:36So those are the major development tools from Adobe, the free SDK for building AIR applications from the command line
03:42and the commercial development tools, the new Flex Builder 3 and upgrades to Flash and Dreamweaver CS3.
03:48Whether you're a Flex, Flash or Dreamweaver developer, Adobe delivers these tools to help you get started building and deploying your AIR applications.
Collapse this transcript
Understanding AIR security
00:00In this video I'm going to describe the security model of applications deployed with the Adobe integrated runtime.
00:07There are two aspects to security with AIR.
00:09First, installation security, and then runtime security.
00:13In both cases the security model is determined by the fact that AIR applications are local native desktop applications,
00:20and just like applications such as Microsoft Word or other software that you might install locally,
00:25an AIR application has the ability to access local resources, such as the local file system, printers and so on.
00:32The major difference between desktop applications and Web applications, in terms of security, has to do with the model of something we call the security sandbox.
00:41Web based applications, whether built in HTML, Flash or Flex, have to run within the sandbox.
00:47This means that as content is downloaded from the Internet,
00:50that content, such as scripting routines, Flash-based content and Flex applications, can't access local resources.
00:57The problem with the Web is that users freely download content from the web and just blindly trust it
01:03and the world of the web browser has been carefully designed to make sure that content coming from the Internet doesn't
01:09have the ability to disrupt or damage content on the local system.
01:12When a user installs an application locally as a desktop application, they grant much broader access to their system.
01:19And so there are two aspects to installation of these applications that have to be handled.
01:23During the installation process the user has to be given adequate information that allows them to make an informed
01:28decision as to whether to grant this local access.
01:31And then at run time, the application has to make informed decisions as to which of its components will be allowed to
01:37access content on the desktop and which won't. First of all,
01:42in order to use this access, AIR applications have the ability to read and write to the local disk.
01:47Both simple text files and complex data.
01:50This is implemented through a set of code libraries that you use in access in your AIR applications.
01:56There's a set of ActionScript 3 libraries that you use from both Flash and Flex and a set of job descript base libraries to use in your HTML applications.
02:05These libraries include the ability to read and write text files to the local disk and then in addition there's data access.
02:12The Adobe integrated runtime incorporates a local database called SQLite.
02:17This is actually an open-source database that is used in a lot of environments.
02:21If you're interested in finding out a lot of detailed information about the SQLite database, you can go to their website at SQLite.org.
02:29You can find out detailed information including what SQL syntax is supported,
02:33what kind of data structures are supported, data types and so on.
02:38Once again, there's a set of API libraries incorporated into the Adobe integrated runtime and made available to you as the
02:44developer, in both the command line tools and the commercial tools.
02:47And as with local file system access, these libraries are implemented both in ActionScript 3 and in JavaScript.
02:54Security in AIR installations is managed through signing.
02:58Whenever you create an AIR application, you must provide something called a digital certificate that verifies your identity.
03:05There are two ways to create these digital certificates.
03:08First of all, all of the development tools, including the command line tool, Flex Builder, Dreamweaver and Flash,
03:14once they've been upgraded to incorporate the AIR development tools, allow you to create your own self-signed certificates.
03:21These certificates are created without any cost, and they're very easy to create, as I'll show you in later videos.
03:26But they're only designed to be used for internal or for low security environments.
03:31This is because when you install an AIR application that's been signed with the self-signed certificate the user sees that the publisher is unverified.
03:39If you trying to build a commercial software application this is clearly an unacceptable state.
03:44And so it's also possible to go get a commercial code signing certificate from one of the security vendors such as VeriSign or Thawte.
03:51When you incorporate one of the commercial code signing certificates into your application, the application publisher's
03:56name is then shown as verified during the installation process
04:00and the user will have better information about who exactly published this application.
04:04These commercial code signing certificates are very strongly recommended if you're building and deploying a commercial
04:09application where the user may not necessarily know you personally.
04:14At runtime, security is implemented once again around the security sandbox.
04:19The application sandbox makes a distinction between resources that are on the Internet and resources on the client system.
04:26Any content that the user has explicitly installed has both complete access to the client system and Internet-based services.
04:34But there are three other types of categories.
04:36There's content that you download from the Internet, which by default only has access to Internet resources.
04:42You can use the Settings Manager of the Flash Player that's a part of the Adobe integrated runtime,
04:47or something called a local trust configuration file, to grant additional permissions to this kind of content.
04:54There's a category called local trusted content.
04:56This is a kind of content that can read from local data sources and can communicate with the Internet but doesn't have complete AIR permissions.
05:03And then there's a category called local with networking, which can communicate with the Internet but not from local data sources.
05:10As we work through the rest of these videos I'll point out particular aspects of the runtime security model for AIR applications.
05:16But take a look at the documentation as well for more complete information.
05:20You'll see the content that's actually compiled into the application has that complete permission to access the local
05:26system where as content to its download from the Internet at runtime has built-in restrictions, because the user has no way of
05:39knowing that that content, such as JavaScript files, and so on, is built by a trusted vendor. So that's a look at the security model for AIR.
05:41As I demonstrate building AIR applications in each of these environments, I'll show you how to build the self-signed
05:47certificate and then integrate it into your installation process.
05:51And then in later chapters as I talk about accessing local files or creating local data structures using the built-in
05:57SQLite database, I'll talk about the security issues with those features as well.
Collapse this transcript
Understanding the AIR application installation experience
00:00In this video I'm going to demonstrate and describe the user experience when downloading an AIR application from the web.
00:06I'm going to be showing you what happens when the user downloads and installs an application and doesn't already have
00:12the Adobe integrated runtime installed.
00:14You can deliver an AIR installer to users in a number of different ways. Because they're simple binary files, you can
00:20email them to the user, provide a link on your website to a simple AIR file, and so on.
00:25But you can create the best and most intuitive user experience with something called an install badge.
00:30An install badge is an Adobe Flash file, which when the user clicks on it, detects whether the Adobe integrated runtime
00:37is installed on the user's system.
00:39If it's already installed, it walks users through the simple application installation process
00:44but if the runtime isn't already installed, it detects that and offers to install the runtime in addition to installing the application.
00:51From the user's point of view, it creates a single easy experience. They don't have to figure out where to go get the runtime from.
00:57They simply click your link, your badge, and from there both the runtime and the application are installed.
01:02I'm going to demonstrate this using a sample application from Adobe Systems.
01:06If you're interested in following along, go to the AIR sample applications page at the Adobe website.
01:11The URL for this page, as of the date I recorded this video, is labs.adobe.com/technologies/AIR/samples.
01:21Now it is quite possible that Adobe will move this around at some point, so if you don't find it at this page, do a Google
01:27search or take a look round the Adobe website and see if you can find a sample apps.
01:31I'm going be installing an application called Fresh.
01:34This is an RSS feed Reader that allows you to connect to and read RSS feeds from online blogs.
01:40I'll navigate down to the Fresh badge and click the Install Now button.
01:45The first step for an installation badge is to detect whether the Adobe integrated runtime is installed.
01:51It's not currently installed on my system so I see this message indicating that I'll be downloading and installing the integrated runtime.
01:58I'll click Yes to continue,
01:59and now the correct version of the Adobe integrated runtime is downloaded to my system.
02:04There are multiple versions of the Adobe integrated runtime out there.
02:08Primarily, you'll see applications that require Beta 2, Beta 3 and the final release version of AIR.
02:14If you have an existing copy of the Adobe integrated runtime on your systems, such as Beta three,
02:19and this application requires the final release version of the Adobe integrated runtime, you'll still need to do the installation.
02:26But starting with Beta 3, the Adobe integrated runtime versions can be installed side by side so that you can have
02:32more than one version of the runtime on your system at the same time.
02:36And one application might require Beta 3, another the final release version and so on.
02:41From the users' point of view, you shouldn't have to worry about that.
02:44To continue with the installation, I'll click the Install button from the Application Install window
02:49and then I'll see a set of options.
02:50Notice that this application requires Beta 3 of the Adobe integrated runtime,
02:55and it's required, so I can't uncheck the option.
02:58I'm also able to add shortcut icons and start the application after the installation,
03:03and I also have control over where the application will be installed.
03:06This application's default location is on my hard disk, in the Program files, AIR examples folder.
03:12I'll click Continue, and then I'm presented with the license agreement.
03:16If I agree with the license agreement I click I agree.
03:19And now the installation starts.
03:22Depending on your network connection, the installation should take only a few moments to complete,
03:27and then, if you selected the option to start up the application upon completing the install, the application should open on your desktop.
03:34I'm not going to spend a lot of time on this particular application. I'll show you just a couple the simple features.
03:39I'll click on an RSS feed, one is provided from the beginning,
03:43and then I can click on the topic of interest. For instance, I'm a Java developers, and I'm interested in this new
03:48product Blaze DS, which is an open-source implementation of some of the features of Live Cycle data services.
03:54I'll double click and I'll see the actual HTML content from the Adobe website displayed.
04:00Additionally I can add my own preferred RSS feeds from any blog I want and I can view those items in the application.
04:07I'll close the application and show you my desktop,
04:10because I want to show you that the application has been installed on my desktop, and I can double-click on it anytime I want to restart it.
04:19If you want to uninstall the application on Windows, it's just like any other native local application.
04:25Go to the Control Panel in Windows Vista, click Uninstall a program or on Windows XP, click Add or Remove programs.
04:32Locate the application, Fresh, and double-click to uninstall.
04:36If your goal is to remove the runtime environment as well,
04:40make sure that you uninstall any applications first and then the runtime environment.
04:45If you want to remove the runtime environment from your system,
04:48you'll find it under Adobe AIR in the list of installed applications on Windows or if you're running on the Mac,
04:54you'll find it in the Applications folder.
04:56So that's a look at the user experience when installing an application and the Adobe integrated runtime at the same time.
05:03As a developer, you might want a little bit more control over which version of the runtime is installed at any given time on your system.
05:09So in the next couple of videos I'll show you how to install the Adobe integrated runtime explicitly on both Windows and Mac.
Collapse this transcript
Installing AIR on Windows
00:00In this video I'm going to describe how to explicitly install the Adobe integrated runtime on the Windows platform.
00:07This installer should work on Windows Vista, Windows XP SP2 and Windows 2000 SP4.
00:14In order to install the Adobe integrated runtime in your system, you do need administrative privileges.
00:19You'll be able to download the install from Adobe Systems.
00:22Go to www.adobe.com/products/air to find the installer for your operating system.
00:29Then on the Windows platform, after you've downloaded the software, double-click to install.
00:35In the Security Warning dialog, click the Run button and you're presented with the Adobe AIR setup screen.
00:41At this initial screen, a license agreement is presented.
00:44If you agree with license agreement, click I agree.
00:47And that's it. The installer does its thing and takes just a few seconds.
00:51click Finish to complete the installation.
00:54Once you've done the installation, any applications that require this version of the Adobe integrated runtime should install without you having to reinstall the runtime.
01:03And as I mentioned in previous video,
01:05as Adobe upgrades the Adobe integrated runtime, you'll be able to install and store more than one version of the runtime on your system at the same time.
01:13For instance, applications that require Beta 3 of the Adobe integrated runtime can leverage that version and
01:19applications that require the final public release, version 1. 0, will be able use that version.
01:25To uninstall the runtime from Windows, at any time, go to the Control Panel.
01:30On Windows Vista, click Uninstall a program.
01:33In Windows XP, click Add or remove programs.
01:36Locate Adobe AIR from the list of available runtimes.
01:39And then double-click to uninstall.
01:42So that's a look in how to install the runtime. It's a very simple, fast process and the entire size of the runtime installer is right around 11 MB.
01:50It's a lot larger, you'll notice, than the Flash Player, but that's because it includes so much more functionality.
01:56Now in the next video , I'll show you how to do the same installation on Mac OS X.
Collapse this transcript
Installing AIR on Mac OS X
00:00In this video I am going to describe how to download and install the Adobe integrated runtime installer on Mac OS X.
00:07When you download the installer from Adobe Systems, it comes to you as a DMG file,
00:11and upon download, or if you double-click it later, will mount a virtual disk
00:15and then you'll see the file the Adobe AIR installer.
00:18You can copy this installer file to your desktop, just drag it out.
00:22And then you can run the installer from the desktop.
00:24When you run it after downloading it from the adobe.com website, you may see a security warning.
00:30If so, just click the Open button,
00:32and you'll see the Adobe AIR installer screen.
00:34If you agree with a license agreement, click the I agree button
00:38and then you need to type in your administrator password.
00:42Type in your password and click OK
00:44and the installation continues.
00:46The installation takes just a few minutes.
00:48When it's done, you'll see the message Installation Completed.
00:51click Finish.
00:52And now you'll be ready to install any AIR applications that you can download from websites or build yourself on this local system.
01:00You can share the Adobe integrated runtime installer with your users quite easily.
01:04Just post it somewhere on a website and let them know how to download it
01:07or you can point to the Adobe Systems website and let users go get the installer directly from there.
01:13Either way, once they've installed the Adobe integrated runtime once, they'll be able to install and use as many AIR applications as they need.
Collapse this transcript
2. Using the AIR SDK
Installing and using the SDK on Windows
00:00In this video I'm going to describe how to install the AIR SDK or software developers kit on Windows.
00:06You going to need two software packages, one of which may already be installed on your machine.
00:12First of all of you need to download the AIR SDK from Adobe Systems.
00:16Go to www.adobe.com/products/air
00:21and locate the SDK and download it to your system.
00:25The SDK comes in the form of a ZIP file, an archive, which you then extract to anywhere on your system
00:32I'm working on Windows Vista. So I'm going to right click on the ZIP file
00:37and select Extract All.
00:38And then indicate that I want to extract the files to a folder that I'm going to name AIR SDK.
00:46You can place these files again anywhere on your system. I prefer to have them under the C: root.
00:52I'll click Extract, and after a few moments the files in the SDK are extracted and ready to use.
00:58That's the only required part of the installation.
01:02There are another couple things that you need to check though.
01:05First of all, the AIR SDK depends on the Java runtime environment.
01:09You must have at least version 1.42 of the Java runtime environment installed on your system in order to use the command line tools in the SDK.
01:18If you're not sure whether you have the Java runtime environment installed, try this.
01:23Go to the Windows Start menu.
01:26If you're working on Windows XP, choose Run.
01:28Otherwise, if you're working on Vista, just click in the search box
01:32and then type CMD, for command, and press Enter.
01:38That will open up a command window.
01:41Then to find out whether Java is installed properly, try this.
01:45Type Java -version.
01:49If you're working on Windows Vista, you probably have Java 1. 6 already installed.
01:55If you're working on Windows XP, you'll only have the Java runtime installed if it's been explicitly installed on your system.
02:01If you need to go get the Java runtime, you can get it from this website,
02:06java.sun.com.
02:08I recommend that you download and use the most recent version of the Java runtime.
02:13From the homepage, move the cursor over the Downloads link and then select JAVA SE, which stands for Standard Edition.
02:20And from there, you should be able to download and install the Java runtime.
02:24Once you've installed the Java runtime and the SDK, here's one more recommended step.
02:29I'm going to close all these windows.
02:32It's a good idea to add the location of the command line tools to your system path.
02:37You modify this by modifying the system environment variable named path.
02:42First I'll go into Windows Explorer.
02:45Then navigate to my C drive, and from there to the new AIR SDK directory that I just created.
02:52Within that directory, there's a bin directory,
02:55and this is where the two major command line tools are stored, ADL and ADT.
03:01So now I'm going to close Windows Explorer.
03:04And I'm going into the Control Panel.
03:07When you open the Control Panel, you'll either be at what's called the Control Panel Home screen or in the classic view.
03:14On Windows Vista, the Control Panel Home screen looks like this.
03:17If you find yourself here, click on Classic View,
03:21then scroll down to the bottom of the list and locate System, and double-click on it.
03:27From here, click on Advanced in Windows XP
03:31or Advanced Systems Settings in Windows Vista.
03:34You should see the System Properties dialog box appear.
03:38From there, click on Environment Variables.
03:41Then scroll down until you locate the Path variable,
03:45and either double-click on it or single click and then click Edit.
03:49Move the cursor to the end of the variable value.
03:53Check to see if there's a semicolon at the end, if not put it in.
03:57And then type in the location of the AIR SDK's bin subfolder.
04:01If you install it on the C: root in a folder named AIR SDK,
04:06your path will have this, C:\AIRSDK\bin.
04:13Click OK.
04:14Click OK again,
04:16and click OK one more time.
04:19You're done in the Control Panel.
04:22Now to test the environment variable,
04:24once again go to a command window.
04:27I have opened up the Windows menu and type CMD.
04:30And again on Windows Vista, instead choose Run and then type CMD
04:34and then press Enter.
04:36And then try typing ADT.
04:39You should see this Help screen appear,
04:42indicating that you're successfully running the AIR developer tool.
04:46You can also try accessing the debug launcher, ADL,
04:49and once again, you should see a Help screen indicating the usage of this tool.
04:54So that's the installation of the software developers kit on Windows.
04:58Now as I've mentioned previously, if you're Flex developer using Flex Builder 3,
05:03or a Flash developer using Flash CS3,
05:06or Dreamweaver developer using Dreamweaver CS3, you may not need this SDK.
05:12That's because all the tools that are part of the SDK are also part of the Dreamweaver extension,
05:18the Flash CS3 update or Flex Builder 3, the new version of the Flex Builder development environment for Flex application developers.
Collapse this transcript
Installing and using the SDK on Mac OS X
00:00In this video I'm going to describe how to install the AIR software developers kit on Mac OS X.
00:05The software developers kit is free to download from Adobe Systems.
00:09Go to the website to be www.adobe.com/products/AIR
00:15and you should be able to find a link to download the SDK.
00:18Make sure you download the right version for your operating system, Mac OS X in this case.
00:23The installer comes to you as a DMG file.
00:26Either upon download, or if you double-click it later, you'll mount a virtual disc
00:30and then that disc will contain all of the files that make up the SDK.
00:34The simplest way to install them is simply to copy and paste or drag them into a new folder in your Applications area.
00:40I'll go to the Macintosh hard disc,
00:43to the Applications folder,
00:45and then in Finder I'll create a new folder by selecting File, New Folder.
00:50I'll name the folder AIR SDK.
00:53Now I'll arrange the windows on my screen,
00:56come back to the folder containing the files,
00:58select all of them by selecting Edit, Select All or pressing Command + A,
01:03and then I'll dragged those files over to the new folder.
01:11Once the files had been copied over, you're ready to start using the SDK tools.
01:15In order to use the command line tools on Mac OS X,
01:18use the Terminal utility.
01:20This is located on a Mac hard disc under Applications, Utilities, Terminal.
01:30All of the binary files that you call in the SDK are in its bin folder.
01:35You can either set an environment variable to make these items available to all the time,
01:39or perhaps a little bit more easily,
01:41you can simply call each application by including the entire path each time you call it.
01:45For instance, in Terminal I'll start off by typing /App with an uppercase "A" and pressing Tab. And Terminal fills out the name of the folder Applications.
01:55Then "AIR", again uppercase, and then Tab again,
01:59that takes me to the SDK folder.
02:01From there to the bin folder, and from there, I'll run the debug launcher, ADL.
02:06And you'll see that I can successfully run the launcher and see the Help information that it displays automatically.
02:12You'll also be using the ADT or the developer tool.
02:15I'll press the Up cursor key to bring back the last command and then change it from ADL to ADT.
02:21And once again I see feedback from the application showing that it's running successfully.
02:25You'll learn how to use these tools in later videos.
02:28How to use the debug log for ADL to test applications and how to use the ADT or the developer tool
02:34to generate self-signed certificates for testing your applications, and then to package applications to get them ready for installation.
Collapse this transcript
Creating a Hello World application
00:00In this video, I'm going to describe how to create the simplest possible AIR application. I'm going to use Notepad,
00:07and create a simple HTML file.
00:09And then in subsequent videos, I'll show you how to create something called an application descriptor file that describes how to
00:15compile the application to the AIR compiler and then I'll show you how to test and compile the application.
00:23I'm going to get started by creating a new folder
00:26in which I'll be storing the application source code,
00:29assets and the application descriptor file.
00:32I'll also be compiling the application into this folder and creating everything I need there.
00:37I'll be working in the folder in AIR Essential Training.
00:41If you're working on Windows, this folder will be on the C drive under the root or whoever you created it when you installed
00:47the exercise files, and if you're working on the Mac, it will be under your users directory somewhere.
00:53Go to the AIR Essential Training folder
00:55and create a new folder
00:58and name it Hello World.
01:03Then double-click into the Hello World folder.
01:07Now open up your text editor.
01:09As I mentioned, I'm going use Notepad just to prove that you don't need anything fancy.
01:14Within Notepad I'll start off by saving the new file into the correct location.
01:19I'll select File,
01:20Save As,
01:22and I'm going to place this file into my new Hello World folder.
01:26I'll give it a filename of Hello World.HTML
01:31and click Save.
01:34Next I'm going to create some HTML markup. The HTML markup doesn't have to be fancy.
01:40I'll just create a pair of HTML tags.
01:43Within the HTML tags I'll create a pair of body tags,
01:48and then within the body tags, a pair of h1 or heading one tags.
01:54Then within the h1 tags,
01:56I'll put in the text Hello World.
02:00I'm not using any cascading style sheets or JavaScript or any other advanced technologies, because again I want to show you how
02:07simple an AIR application can be.
02:09I'll save the file,
02:12close Notepad,
02:14come back to the Hello World folder, where I see the new file,
02:17and then I'll double-click to open it in the browser.
02:20And show you that this is basic everyday HTML that is being displayed correctly in the browser.
02:26Now in the next video I'll show you how to create the application descriptor file that will be used to tell the compiler how to build the application.
Collapse this transcript
Creating the application descriptor file
00:00In this video I'm going to create the application descriptor file.
00:03The application descriptor file is an XML file with a particular element names and property settings. The purpose of
00:11the application descriptor file is to tell the compiler how you want your AIR application to be built.
00:17Rather than creating this file from scratch, I'm going to start from sample file that's included with the AIR software developers kit.
00:25In Windows Explorer, I'll start by going to the C drive
00:28and then from there to the AIR SDK folder.
00:32If you're working on the Mac, go to the AIR SDK folder that you created in your Applications folder when you installed the AIR software developers kit.
00:41The AIR SDK folder has a Samples folder
00:44in which you'll find a file called descriptor-sample.XML.
00:48I'm going to make a copy of this file.
00:51I'll right-click on it and select Copy,
00:54then I'll go back to the C drive, to the AIR Essential Training folder,
00:59to my new Hello World folder,
01:01and I'll paste the file into this folder.
01:04Then I'm going to rename the file.
01:06Instead of descriptor-sample.XML. I'll name it HelloWorld.XML.
01:13And then I'll open it in a text editor.
01:17If you're following along, you can use whatever text editor or XML editor you like.
01:23I'll open the file in Notepad
01:26and then expand Notepad to full screen so we can see what's in the file.
01:31The application descriptor file always starts with an XML declaration at the top
01:35and then has an application root element.
01:38The XMLNS attribute represents an namespace.
01:43The nature of an XML namespace is that it's an identifier for the XML processor, in this case the AIR compiler, that tells it what version of the language is being used.
01:53The XML namespace represented here, ending with the value 1. 0, describes the initial public release of AIR 1.0.
02:02In older versions of these files, you might see something like 1.0.M5 or M6.
02:08This would describe a particular beta version, an older version of the runtime.
02:13The purpose of the namespace here is to tell the compiler which version of the runtime this application requires.
02:20And this particular namespace, ns.adobe.com/AIR/applications/1.0, describes the initial public release. Not any of the betas.
02:31I'm going to go through and strip out values that really aren't needed for a very simple application descriptor.
02:37For instance, the minimum patch level has to do with managing upgrades and we're not going to be upgrading this file initially so I'll take that out.
02:45And this initial comment isn't required either. I'll remove it.
02:50The next element listed is called the ID.
02:53The ID is the unique identifier for the application.
02:57Every AIR application has an ID
03:00and the most common convention for creating an ID is to take your organization's domain name [and] reverse it.
03:07So for instance lynda.com would be com.lynda and then using dot notation, adding a unique identifier for the application.
03:16My application is simply called hello world and its built for lynda.com so I'm going to set the unique identifier to com.lynda.helloworld.
03:27Each AIR application you create should have its own unique ID.
03:31The next few values are informational.
03:34I'll set the name of the application to Lynda.com Hello World, and the name can be anything you like, and then version
03:44number is a value that you assign to indicate which version of the application you're building.
03:49This is going to be version .1.
03:53Meaning it's in a very early phase of development.
03:57The filename element is a descriptive value that describes the name of the installer or the application executable.
04:04You put a value here that represents the beginning of your application installer without the .AIR extension. I'll change my filename to Hello World with no spaces.
04:14The description is just that- it's a descriptive value, and you can either fill it in or leave it out.
04:20I'm going to set my description to the value, "This is the Lynda. com Hello World application."
04:26The copyright again is informational only; it doesn't affect the functionality of the application but if you want to
04:32copyright the content you should put in your organization name.
04:36The next set of values do affect the application's functionality.
04:40The initial window element contains properties that describe the initial window of the application.
04:46As the application starts up,
04:48the file name that you put into the content element represents what will be presented to the user.
04:53This file can either be a SWF file, generated out of Flex or Flash, or it can be in HTML file.
05:00In my very simple application, I'm going to set the content to HelloWorld.HTML.
05:10The title element contains a string value, which is displayed to the user in the title bar of the initial window of the application.
05:17I'm going to change the title from example application
05:21to a value that the user will see of "Hello from AIR!"
05:27The next two values are optional, systemChrome and transparent. I'll describe those in a later video and for now I'm just
05:33going to remove them from my very simple application descriptor.
05:37The visible property for a simple application like this should be set to true.
05:42That means that the application's initial window will be visible to the user without having to execute any code upon application startup.
05:50The next few values affect the behavior of the initial window,
05:55indicating whether the application can be minimized maximized and resized. If you leave these out, they're reset to defaults,
06:02so I'm going to remove them,
06:04and move on to the application dimensions.
06:07The width and height of the application are set in terms of pixels.
06:11I'm going to set my application's initial width to 400 pixels
06:15and the initial height to 300 pixels.
06:19The X and Y properties indicate the location of the initial window on the screen.
06:24If you set these values you're specifically positioning the application's initial window. If you leave them out, as I will,
06:31you're allowing the operating system to place the initial window.
06:35You can also set the minimum and maximum size of the window, but I'm going to take these values out and once again allow the
06:41operating system to manage those settings.
06:44The rest of the settings within the application descriptor file can be removed. They all have default values or are
06:50otherwise not required for a very simple application like this.
06:54So I'm going to remove all the elements underneath initial window but make sure that you leave in the closing
06:59application tag to ensure that your XML file is well formed.
07:04So this is a minimal application descriptor file.
07:07Nw in the next video I'll show you how to test the application using the debug launcher and then I'll show you in the
07:13following video how to compile the application and get it ready for installation.
Collapse this transcript
Testing an AIR application from the command line
00:00In this video I'm going to describe how to run an AIR application from the command line using an application called the debug launcher.
00:07The actual name of this application is ADL and it's in the bin folder of the AIR STK.
00:14When you installed the SDK in an earlier video, I described how to add the bin folder to your system path, meaning that you
00:21can run the ADL application from anywhere, from any command window.
00:25To run the Hello World application, start by opening a command window.
00:30On Windows Vista or XP, open the Start menu
00:33and then if you're running on XP, click Run. If your running on Vista, you'll start off in the start search dialog and
00:40type CMD and press enter.
00:43If you're working on a Mac, open the Terminal application from the Utilities section of the Applications folder.
00:49Next switch to the location of your application. I'll type in cd\
00:55then I'll type in AIR and press Tab.
00:58That takes me to the AIR Essential Training folder
01:00and then I'll start typing hello, press Tab again.
01:03And that switches to the Hello World folder.
01:06I'll type DIR
01:08to give me a listing of the files in this folder and verify that I'm in the right place.
01:13Now I'm going to run the application from the command line. Type ADL, then a space, then the name of the HelloWorld.XML file,
01:23the application descriptor and press Enter or Return on the Mac.
01:28If all goes well, you should now be able to run your application and it should become visible.
01:33So notice that this is a standard operating system application.
01:37If you're running on Windows, you should see the Windows chrome or standard buttons at the top bar and if you are
01:43running on a Mac, it should look just like a standard Mac application.
01:46You can resize it, maximize it, move it around the screen, and do everything that you would normally do with the standard
01:53native application, because that's what it is. It's a native local application running on your desktop.
01:59Close the application and you'll return back to the command window.
02:04Now in the next video I'll show you how to add a little bit of debugging so that you can actually send tracing messages to the command window,
02:12from within your application.
Collapse this transcript
Using Debug Tracing in an HTML application
00:00In this video I'm going to show you how to add tracing functionality to an AIR application.
00:05Tracing describes the ability to add debug messages to an application,
00:09whether those messages then show up in a console or other sort of debugging environment.
00:14When you're using the software developers kit, the SDK,
00:18the command window itself is your debug environment,
00:21and after we add this functionality, you'll be able to send debugging messages to that environment using JavaScript code.
00:27I'll show you how to do the same thing using Flex applications and Flash applications in later chapters.
00:33For AIR applications that are built in HTML, in order to send these sort of tracing messages, you need to add a JavaScript file to your application.
00:43I'll navigate to the AIR SDK folder, for software developers kit folder, and from there to the frameworks folder.
00:50The frameworks folder has a number of different JavaScript files named AIR aliases, AIR Introspecter and AIR source viewer.
00:58I'm going to copy and paste the AIR aliases JavaScript file
01:02into my application folder.
01:05I'll select the file,
01:06copy it to the clipboard.
01:09Return back to my Hello World folder
01:12and paste the JavaScript file.
01:15Now I'm going to link that file into my Hello World file.
01:19I'm going to open up Notepad
01:23and then come back to the folder and drag that file into Notepad
01:27so that I can make some changes.
01:33You can use whatever text editor you like, if you're following along.
01:37Within the HTML element of my file, but before the body, I'll start off by creating a head section. Within the head
01:46section I'll declare 2 script elements. The first will be a source attribute, actually SRC, which will point to my aliases file.
01:55The name of the file is AIR Aliases.JS.
01:59Make sure that you spelled this exactly correctly, including case sensitivity,
02:03and then set the script element's type to a value of text/JavaScript.
02:11After the script begin tag, put in a script end tag. You must close the end tag in this fashion, otherwise the scripting won't work.
02:20Next, create another script element and set the type once again to text/JavaScript.
02:28And add an end tag on the next line.
02:31And then between the two script tags declare a JavaScript function. Name the JavaScript function load handler. We're going
02:40to be calling this upon the load event of the body element.
02:46Put a pair of braces after the function
02:49and then within the braces put in this command, air.trace. The variable air is declared by the AIR Aliases.JS file,
03:00and it's an alias that describes a particular object, the runtime itself.
03:04The trace method can be called from the AIR object whenever you need it.
03:09I'm going to put in a simple message, "This is an AIR trace message."
03:16Now in order to call that method upon application start up, I'll go down to the body element and put in an onLoad event handler.
03:25Within the quotes I'll call my new method, loadHandler.
03:30Make sure to include the opening and closing parentheses both after the function name and where you call the function in the on load event handler.
03:39Save your changes.
03:42So this should now work. I declared the AIR aliases JavaScript file and incorporated it into the application.
03:48I declared my custom loadHandler function,
03:51and within that function called the trace method of the AIR object, which was declared in the Aliases file,
03:57and then as the application starts up, when the on load event occurs, I'm calling the loadHandler function.
04:04Lets give it a try. I'll now switch back to the command window.
04:08If you following along and you closed your command window, open it and switch back to the Hello World folder.
04:15Now we'll run the application again. Once again we run the debug launcher, ADL, and pass in the name of the application
04:23descriptor file, HelloWorld.XML.
04:26There's the application again,
04:28and now I'll switch back to the command window and you'll see the trace message appear.
04:33Once you've incorporated the AIR Aliases.JS file, you can call the trace message whenever you need to.
04:40Particularly when you're working with the software developers kit, and not with one of the more advanced development
04:45environments such as Flex or Dreamweaver, you'll find that this feature will really help you debug your applications and
04:51find out what's going on in them at runtime.
Collapse this transcript
Creating a self-signed security certificate
00:00In this video I'm going to describe how to use the AIR developer tool ADT to generate a self-signed security certificate.
00:07As I described in a previous video, before you can compile your AIR application into an installable file, you first need a security certificate.
00:17This self-signed version of the security certificate is suitable for internal use and for testing and development. As I
00:23mentioned earlier, if you're actually building an application for commercial distribution, you'll want to investigate
00:29getting of verified security certificate from one of the security vendors, Thawte or VeriSign.
00:36To create a self-signed security certificate,
00:38open the command window and switch to whichever folder you want to create a certificate in.
00:43I typically create the certificate right there in the application folder just for simplicity.
00:48Then type in the following syntax: ADT,
00:53then the property -certificate, meaning we're using the developer tool to create a certificate.
01:00Next pass in the certificate name. The certificate name can be any value you want and is simply an identifier.
01:07I'm going to call it MyCertificate.
01:11Next pass in this literal value: 1024-RSA.
01:18You can also use other values such as 2048.
01:21If you curious about what these values mean, check the documentation.
01:25Next, type in the name of the file that you want to create with the .PXF file extension.
01:31I'll type in a value of MyCertificate.PFX,
01:37And then finally type ub a password.
01:40Whatever password you type in and will be encrypted into the security certificate and then later on, when you compile
01:47your applications using the certificate, you need to provide the password each time.
01:51So make sure you put in a password that you remember.
01:54I'll execute the command,
01:56then switch back to Windows Explorer, or Finder if you're on the Mac and show you that the certificate has been created.
02:03The name of the file is MyCertificate.PFX and in next video I'll show you how to use the self-signed security certificate to build your application install file.
Collapse this transcript
Compiling an AIR application from the command line
00:00In this video, I'm going to describe how to build your applications installer file.
00:05Before you create the installer, you must have a security certificate.
00:09If you haven't done that yet, go back to the previous video and generate your own self-signed security certificate and
00:15then you'll be able to do this exercise.
00:18I'm once again using the software developers kit to do all this so to get started open a command window and navigate to the Hello World application folder.
00:27Here's the syntax for creating the AIR file.
00:30The installer.
00:32Start off with the name of the developer tool application, ADT.
00:36Then the command, package.
00:38You type it in with a hyphen in front -package.
00:42Next type in the value -store type, space,
00:47PKCS 12 and that indicates what kind of encryption certificate you're using.
00:54Next type in a value of -keystore.
00:58And then the name of your PFX security certificate file. Mine is MyCertificate.PFX.
01:06Next type in the name of the AIR file you want to create.
01:09The file name can be anything you like, but it must have a .AIR extension. I'm going to type in the value of Hello World.AIR.
01:17And next, type in the name of the application descriptor file. Mine is called HelloWorld.XML.
01:25Finally, type in the names of all the files that need to be included in this application.
01:31Now you may be thinking, what about a complex a pplication that includes literally dozens of files?
01:36Well in that case their ways of creating application descriptor files that indicate all the files that need to be included.
01:43Here we're doing something very simple, an application that just includes two files.
01:48I'll start with the name of my initial content file, HelloWorld.HTML,
01:53and then I'll also include the AIR Aliases.JS file,
01:57because I refer to that file in my HTML content.
02:01So that's the entire command. Let me review it before I press Enter.
02:05Start off with ADT,
02:07and the command package,
02:08then a store type property set to PKCS 12, which is the type of certificate you're using.
02:15Then the name of the certificate file in the keystore property,
02:19then the name of the AIR file that you're creating.
02:22Then the name of the application descriptor file,
02:25and finally at the end, a list of all the files that need to be incorporated into the installer.
02:31I'll press Enter
02:33and notice that I'm prompted for a password.
02:35This is the password of the self-signed security certificate. I'll type in the value,
02:41and press Enter.
02:44And after just a few moments, the compilation is complete.
02:47I'll switch back to Windows Explorer, or if you're working on a Mac, to Finder.
02:52And you should find your compiled application there HelloWorld.AIR.
02:57So that's how you do the compilation.
02:59Check the documentation for additional details of the properties that you can use when you call the ADT application from the command line.
03:06And again remembered that ADT is used both to generate the certificate and then to use the certificate to compile the AIR application installer.
Collapse this transcript
Installing and uninstalling an AIR application
00:00In this video I'm going to describe how to install your completed AIR application.
00:05In previous videos, if you followed along in the exercises, you installed the latest version of the Adobe integrated
00:11runtime on your operating system.
00:13And then using the SDK, you created your AIR file.
00:17The AIR file now stands alone from the rest of the source code. It incorporates everything you need for the AIR application install.
00:24So to demonstrate this, I'll open up Windows Explorer, or Finder on the Mac,
00:29and navigate to the Hello World folder that contains my application files.
00:34I'm then going to copy and paste the AIR file to my desktop
00:42and then I'll close Windows Explorer.
00:44My goal here is show you that this file is no longer dependent on the other files in that folder and can be installed
00:50on any client systems running Windows or the Mac, as long as the integrated runtime is already installed.
00:57Now to do the installation I'll double-click on the AIR file,
01:01and I'll be prompted, are you sure you want to install this application to your computer?
01:05Notice that the publisher name says Unknown.
01:08This is because I used a self-signed security certificate and its examples of the reasons why for a commercial
01:15application you want use one security certificates from one of the major security vendors.
01:20I know that I created this application though and I'm just testing, so I'll click the Install button
01:26and then I'll be prompted for various options.
01:29Notice that the application name, version and description are listed on the application install screen. These values came
01:37from the application descriptor file.
01:40I have installation preferences to add shortcut icons my desktop and to start the application after installation.
01:47I can also select the installation location.
01:50Notice that the default location is simply C:\program files. I'm going to install my application in the Hello World folder,
01:59and I'm going to except all the installation preferences.
02:02I'll click Continue and after just a few seconds my application has been installed, and it's running on the desktop.
02:10I did include the application preferences to add the icon on the desktop and so I'll close the application and show you that
02:17the icon is there and now I'll double-click to run the application again.
02:22I can also go to the menu
02:26and notice that the Hello World item appears in the Start menu of Windows. Now if you're running on a Mac, you'll go to the
02:32Applications folder and you will create a Hello World folder under Applications.
02:38On Windows I can run the application from the Programs folder and it works fine.
02:43And I can also go to the C drive's Program Files folder.
02:46From there to Hello World,
02:49and there you'll see another folder named Hello World and within that an executable or in the case of the Mac, an app file.
02:57I'll double-click the executable.
03:00And once again, there's my application.
03:03Also you one other thing in Windows, which I think is useful to understand.
03:07With the application running I'll go to the Task Manager.
03:11If you're working on a Mac, you can use the Activity Monitor instead.
03:15And I'll show you that the Hello World application is listed under the Processes list. It is using about 13 1/2 megabytes of memory
03:22to execute a very simple bit of functionality.
03:25Every AIR application has a base memory usage,
03:29and then as your application gets more complex, it will increase as needed, but you'll notice that relative to other
03:34Windows-style applications, it is pretty reasonable.
03:38Finally let's take a look at how to uninstall the application.
03:42I'll close the windows,
03:44go to the Control Panel.
03:47From there click on Uninstall a program, or if you're working on Windows XP, select Add and remove programs.
03:54And then you'll see the application listed by its application name. That's the value that was put into the application descriptor file.
04:01is noted here is Lynda.com Hello World 1. 0.
04:05Within this list I'll double-click on it.
04:07When I see the Installer dialog, I'll click Uninstall,
04:11and I've now removed the application from my desktop system.
04:14I'll click Finish
04:16and close the Uninstaller window.
04:18So this is been a look at how to install and uninstall and how to use the application on the Windows platform.
04:25If you're working on the Mac, it'll be a little bit different in that there's no official uninstall process. Instead you
04:31just go to the Applications folder and you remove the application by dropping it in the trash.
Collapse this transcript
3. Creating AIR Applications in Flex Builder 3
Creating a desktop application project
00:00In this chapter of the video series I'm going to describe how to create an AIR application using Adobe Flex Builder 3.
00:08One of the most important new features of Flex Builder 3 is the fully integrated AIR software developers kit.
00:14When you create a new Flex project, you now select from the beginning whether the project is designed to be deployed on the web or on the desktop.
00:22When you select the desktop, you are creating an AIR application.
00:26It's important to note that isn't currently possible to create a single project that can deploy both to the web and to
00:33the desktop. It is possible to create two projects that share assets, and that's a very common approach for developers
00:46who want to multi-purpose their content. That is create a single application that they can deploy to either target.
00:47To get started, if you're following along with the exercises, open Flex Builder 3, which I'll already have open on my desktop, and then switch workspaces.
00:56From the Flex Builder menu, select File, Switch Workspace, and
01:00then select the folder that I have displayed here, C:\AIREssentialTraining\Flex.
01:08As always when you switch workspaces in Flex Builder 3, it will result in closing, Flex Builder and then re-opening it,
01:14This allows Flex Builder and Eclipse to release any locks on files or folders.
01:20Now, create a brand-new Flex project.
01:22From the menu, select File,
01:26New,
01:27Flex Project.
01:29If you've already been working with Flex 3 so far, this will be familiar.
01:33Now set the project name, which can be anything. I'm going to call it Hello From Flex and AIR.
01:40I'll use the default location to create a project folder right under my workspace, where the name of the project folder
01:46matches the name of the project.
01:48For the application type, select Desktop application (runs in Adobe AIR).
01:54This first application won't use an application server so leave the application server type set to None
02:00and click Next.
02:02The output folder is where your compiled application is created.
02:05Flex Builder 3 distinguishes between the output folder, which you create during project creation, which is your debug output,
02:12and the release version folder, which you create during the export process.
02:17Leave the output folder set to the default of bin-debug and click Next.
02:21Next set the main application file.
02:24The main application file should have a .MXML file extension and follow the conventions of an ActionScript class name,
02:31that is include letters, numbers and underscores and you must start with an alphabetical letter.
02:36By convention, the initial character of an ActionScript class name is uppercase, so I'll usually create my
02:43applications with initial uppercase characters too.
02:46If you worked through the previous chapter about the AIR SDK,
02:49I described in that chapter the nature of the application ID.
02:53An application ID is the unique identifier.
02:56The intention of the application ID is to create a globally unique identifier.
03:00You typically do this by prefixing the ID of the application with the domain of your organization reversed.
03:07So for instance, Lynda.com becomes com.Lynda.
03:12I'm going set my application ID as com.lynda.HelloFromFlexAndAIR.
03:18If you want to change the application ID later on, it will be very easy because this information will be stored in the
03:23application descriptor file, the same XML file that I showed in the previous chapter.
03:28Now click the Finish button to create both the Project and the main application file.
03:33It takes a few moments to create the application.
03:36The first thing that you may notice is that the root element of an AIR application uses an element called windowed
03:42application, instead of the Flex application element that's used for web applications.
03:48The windowed application component is a subclass of the application. So if you're familiar with the Flex application
03:54component in all of its properties, methods and capabilities,
03:58this component does all the same things,
04:00that is designed to be presented as a desktop window instead of the window embedded and displayed in the Flash Player.
04:07Over in the Flex Navigator view, you'll notice that in addition to the .MXML file, an application descriptor file has
04:13been created with the.XML extension.
04:16This file follows the same structure as the version that I used in the SDK chapter.
04:21It has all the same properties and the properties meanings are the same and so for instance, if you wanted to reset
04:27the application ID, the file name or the application name, you would do it in this file.
04:32Go back to the application file and set its Layout property to a value of Vertical.
04:39Then place the cursor inside the windowed application component and add a Label component, set its Text property to "Hello
04:48from Flex and AIR!" and to make it a little more dramatic, set its font size to 18 pixels and its font weight to bold. Save your change and run the application.
05:05The application opens as a desktop window.
05:08This is a native application now running in your Windows or Mac operating system. To close the application, click the appropriate close button.
05:15The application look like a native application, determined by your operating system.
05:20If you're running on Windows, it looks like Windows application and if you're running on Mac, it looks like a Mac application.
05:25So that's the basics of how to create an AIR application in Flex. In the next few videos I'll talk about some of the
05:31details of working with AIR applications and Flex Builder including how to package your application for installation.
Collapse this transcript
Understanding Flex/AIR application architecture
00:00In this video if I'm going to describe some of the unique behaviors and capabilities
00:04of AIR applications that are built in Flex Builder.
00:07As I showed in the previous video,
00:09when you create a brand-new desktop application in Flex Builder 3 the root element of the MXML file is windowed application.
00:17Instead of the traditional application element that you see in web-based Flex applications.
00:21One of the best ways to learn about some of the unique capabilities of desktop applications built in Flex is
00:27to take a look at the Help system for the windowed application component.
00:30If you're following along in these exercises, open the file that you created in the previous vide, HelloFromFlexAndAIR.MXML,
00:38and then place your cursor into the windowed application tag,
00:41and press Shift + F2 to open the Help screen for that component.
00:46Once the Help screen opens,
00:48the first thing to look at is the inheritance hierarchy of the windowed application component.
00:53Notice that the windowed application class is subclassed or extended from the application class.
00:59It inherits all the properties, methods and capabilities of the traditional application component.
01:06So that means anything you can do in a web-based application in Flex, you can also do in an AIR application,
01:12but there are certain capabilities and behaviors that have been added to AIR applications because of their unique capability as desktop applications.
01:20To see some of these, go to the Property section of the documentation.
01:24Click the Properties link. When you get to the public properties, if you see all the properties of both the windowed
01:29application and the application components,
01:32click the link Hide inherited public properties, so that now you're only looking at the properties their unique to the
01:38windowed application. Here are some the things that you can do that are a little different.
01:42AlwaysInFront is a property of the windowed application component which helps you dictate that your application should
01:48always have the usual focus in the Windows system.
01:51This is something that wouldn't make any sense in the context of a Web application, where the application is running in the
01:56Flash Player nested within the browser.
01:59But because AIR application is a part of the native operating system, whether you are running on Windows or the Mac,
02:05it can participate in the Z order of the window layering and by setting AlwaysInFront to true, you're indicating that
02:11your application should always stay on top of the stack.
02:15There are properties called dockIconMenu and menu, which are datatyped to the class called FlexNativeMenu.
02:21I'll be describing how to use these many classes in a later chapter of the video series,
02:25but briefly, these allow you to assign operating system native menus to your Flex application, so that the menus look
02:32exactly the same as the other menus for other applications that are running in your operating system, either Windows or the Mac.
02:39There are a few properties that determine how the user can interact with the window.
02:43Their named to minimizable, maximizable and resizable.
02:48These are values that are read only. For the windowed application component, you set these to the application descriptor file
02:55so that they're compiled into the application and they determine how many control buttons are displayed by the
03:00application and whether the user is allowed to resize the application.
03:04There's a property called showStatusBar that I'm going to go into in a little more detail.
03:09The nature of the showStatusBar property is that if set to true, which is the default, it shows the status bar at the bottom of the application.
03:17Then in your ActionScript code or MXML declarations, you can set a status property that causes a value to appear in the status bar when it's visible.
03:27I'm going to close the application
03:29and I'm going to add an attribute called status
03:33and set its value to a simple string of "the application is open!".
03:39I'll save it and run the application
03:44and take a look in the lower left-hand corner.
03:47The status bar appears at the bottom of the application and whenever you create a brand-new window in your Flex
03:52application, by default every window has the status bar.
03:56If you don't want the status bar to appear, set a property called showStatusBar to a value of false.
04:03Now, even with the status property set, the status bar won't appear.
04:08There are many properties like this throughout the AIR application architecture.
04:12It's up to you to decide how you want your application to look and behave.
04:16The best way to acquaint yourself with all these details is to take a look at the documentation for the windowed
04:22application component and from there, follow the trail of all the new components that are unique to AIR applications when
04:28you're building applications in Flex Builder.
Collapse this transcript
Debugging an AIR application in Flex Builder
00:00In this video I'm going to describe how to debug AIR applications that are built in Flex Builder 3.
00:06To demonstrate this, I'm going the import a project from the exercise files area.
00:10From the menu and select File,
00:13Import,
00:14Flex Project.
00:15In the Import Flex Project dialog box, click the first Browse button
00:20and navigate to the location of your exercise files.
00:23I've placed mine under AIR Essential Training.
00:26From there go to the Flex folder,
00:29and from their select debuggingAIRapps.ZIP and click Finish.
00:35Open the project and then open the source route
00:39and open the file debuggingAIRapps.MXML.
00:42This application is designed to allow is to do a little bit of debugging.
00:46The tools for debugging AIR applications built in Flex are exactly the same as Web applications built in Flex.
00:52You can use the trace function, the breakpoints, variables views and so on.
00:57The first demonstration will be of the trace function.
01:00The trace function in Flex sense logging messages to logging targets
01:05and the default logging target is the console view in Flex Builder 3.
01:10Notice that there's a function called traceIt in this application which calls the trace method and passes a simple string of executing traceIt.
01:18And then there's a button at line 24 that executes that method.
01:22To see traceIt at work, open the application.
01:25Then go to the toolbar and click the Debug button.
01:29When the application opens, click the Trace button
01:32and watch the console view in Flex Builder.
01:34Each time you click the button, you'll see the trace message sent over to the Consule view and displayed there.
01:41To terminate the debugging session, just close the AIR application and you return back to Flex Builder.
01:47Next breakpoints.
01:49Breakpoints work exactly the same as they do in Web applications built in Flex.
01:53You place a breakpoint at the line you want to suspend the application.
01:57You can do this in Flex Builder by double-clicking next to the line number, right-clicking and selecting
02:02Toggle Breakpoint or pressing Control + Shift + B.
02:06Once again, debug the application.
02:10When the application appears, click the Debug button. That will execute the method in which the breakpoint was placed.
02:17In the background Flex Builder presents a dialog asking if you want to open the Flex debugging perspective.
02:23Click on the dialog, then click Yes.
02:26Just as with Web-based applications and Flex Builder.
02:29You can inspect variables, use watch expressions and otherwise inspect what's going on internally in your Flex application as it executes.
02:37For instance with the active breakpoint in the debugIt method I have access to the property's localVar and i
02:43that are declared within this application.
02:45I can step through application code using the stepping buttons in the debug view.
02:50I'll click the Step Over button or press F6 to step one line at a time
02:55and watch what happens in the variables view in the upper right hand corner.
03:00As I step through the code, I'm updating the value of various variables.
03:04As with Web applications, you can use the expressions view.
03:08I'm going to right-click on the myVar expression,
03:11and then select watch myVar.
03:14That opens the expressions you and places myVar in the expressions view.
03:19And then I'll continue stepping through the code and watch the value update each time through the for loop.
03:26So that's a basic look at debugging applications in AIR.
03:29Every debugging tool that you have available and Flex Builder for classic web applications built in Flex also works
03:36exactly the same way when you're working with AIR applications.
03:39Just as with Web applications, make sure that you explicitly terminate your debugging session either by closing the
03:46application or by clicking the Terminate button from within Flex Builder.
03:50If you click Terminate button within Flex Builder, it will result in closing the application as well.
03:55And just as with classic Flex applications built for the Web,
03:59trace statements and other debugging information is not a part of the final release build that you create when you're
04:05ready to package your application for installation.
04:08That version of the application will be fully optimized and all of the debug symbols, trace functions and so on will be removed.
Collapse this transcript
Using HTML content in a Flex application for AIR
00:00In this video I'm going to describe how to embed an HTML browser component in a Flex application that's deployed on AIR.
00:08The Adobe integrated runtime includes an integrated Web browser kernel that's based on the Web kit kernel, the same one
00:15that's a part of the Safari web browser.
00:17You can embed any number of instances of this kernel in a Flex application deployed on AIR and it will be able to browse
00:23websites, execute JavaScript, use cascading style sheets and so on to display organizations webpages.
00:30To demonstrate this I'm going to create a brand-new Flex project.
00:34If you'tr following along in the exercises from the menu, select File,
00:38New,
00:39Flex Project.
00:41Name the project HTMLinFlex.
00:46Set the application type to Desktop application.
00:49Click the Next button.
00:51click Next again,
00:53and then click Finish to create the project and the application.
00:59Set the application's Layout property to Vertical and then place the cursor between the windowed application tags.
01:07To instantiate an HTML component in a Flex application, declare an mx:HTML tag.
01:14This tag creates an instance of a browser.
01:17Assign an unique ID property.
01:20I'll call it myHTMLBrowser
01:24and set its width and height properties to 100% of the application.
01:28To set the browser's current URL, that is indicate which webpage you want to display,
01:32set the HTML component's location property.
01:36I set the location property to a value of http://www.adobe.com.
01:45Than I'll save and run the application.
01:48As the application starts up, it creates the browser kernel and then navigates to the page that I selected.
01:54I'll double-click on the top of the application to expand it to full screen
01:58and you'll see that the embedded browser is able to display complex HTML, cascading style sheets, execute JavaScript code
02:06and display Flash-based content.
02:08I'm going to close the browser and create some controls above it.
02:13Go back to the code and place the cursor above the HTML component and create an Hbox container.
02:21Within the Hbox container, declare a label
02:25and said its text property to URL.
02:28Set the label control's font size style to 18 pixels.
02:33Then after the label create a text input control. Set its ID to urlInput.
02:41After the text input control, add a button control,
02:46said its label property to Go,
02:49its font size once again to 18,
02:55and then add a click event handler.
02:58In the click event handler, execute this ActionScript code.
03:03myHTMLBrowser.location equals urlInput.txt.
03:12Be sure to add the characters at the end of the line to close the button tag and now test the ability to navigate with a browser to other webpages.
03:21Click the Run button.
03:23As the application starts up, it once again displays the Adobe webpage.
03:28But now I can click into the URL input and type in another site. I'll navigate to www.google.com,
03:38and now I'm looking at the Google page.
03:40Let's had a couple other functions.
03:42As with all good browsers, you can move forward and back through the browser's history.
03:48The HTML component includes methods for this purpose called historyForward and historyBack.
03:54I'll create a button and set its label to forward. I'll match the existing font size of the other button and I'll set it to
04:0218 and so it's more visible in the recording. And then the click event I'll call myHTMLBrowser.history.Forward.
04:11Now I'll select that button and clone it by pressing Control + Alt + Down. For the new instance the button I'll set
04:18it's label to back.
04:20And in the click event handler I'll call the browser's historyBack function.
04:26I'll save and run the application.
04:33As the application starts up, it loads the Adobe website once again.
04:38I'll click into the URL input control
04:41and type in http://www.bardotech.com, that's my own company's website,
04:49and bardotech.com.
04:52I'll click the Go button.
04:54I'll see my website.
04:56I'll click the Back button
04:58and go back to Adobe.
05:00Click the Forward button
05:01and go forward to mine.
05:03So the HTML component allows you to embed complex HTML. It's able to display content based on Flash of course, because
05:11the application itself is Flash-based. So you have Flash embedded in HTML embedded in Flash.
05:17The HTML component is a complete Flash component too.
05:21You can apply filters to rotate the object and do anything else you can with visual components in the Flex environment.
05:29So that's a look at how you can integrate HTML content and a complete web browser inside a Flex application designed for
05:36deployment on the Adobe integrated runtime.
Collapse this transcript
Deploying a release version from Flex Builder
00:00In this video I'm going to describe how to package your Flex applications that's designed for AIR as an AIR install file.
00:08In Flex Builder 3 this process is called exporting a release build.
00:12During the expert process you'll have an opportunity to create a brand-new security certificate if you need one or
00:18you'll be able to select your security certificate that you've already created.
00:22For this demonstration I'm going use the HTMLinFlex application that I created in the previous video.
00:29If you're following along with the exercises, you can do this with any of the applications that you've created.
00:34From the menu, select Project,
00:38Export Release Build.
00:39You can also get to this feature from the menu through File, Export.
00:43In the Export Release Build dialog select the project and application that you want to export.
00:49I had already selected my application in the Flex navigator view, so the Export Release Build wizard is already set to the correct items.
00:57Next, set the name of the file that you want to create.
01:01I'm going to except the default of HTMLinFlex.AIR.
01:04Then click Next.
01:06As with all AIR applications, in order to build the installer you must provide a digital certificate.
01:12If you have a certificate that you've purchased from Thawte or VeriSign, you can import it here.
01:17Or you can create a self-signed digital certificate,
01:20As I described in previous videos, when use a self-signed certificate, the installer will show that the publisher is unknown and unverified.
01:28So these kind of certificate is only really useful for internal or testing use.
01:33You can also export what's called an intermediate AIRI file that you can sign and complete later.
01:40For instance in an organization where there are security specialists who have access to the security certificates,
01:46you might export the intermediate file and then hand the file to those people for actual signing and preparation for release.
01:53I'm going to create a brand-new digital certificate in this exercise.
01:57I'll click the Create button
01:59and then fill in the information for the certificate.
02:02The publisher's name will be Lynda.com.
02:05You can also add information such as an organizational unit and an organizational name or you can leave those values blank.
02:12There are two types of certificates that you can select, 1024 and 2048 RSA.
02:18As I did in the demonstrations for the SDK, I use the 1024-RSA style.
02:24Now I enter a password. I need to type it twice.
02:29And then I indicate where I want to save the file.
02:32I'll Browse folders,
02:34and select my HTMLinFlex folder,
02:37and then I'm going to set the file name as myCertificate and notice that it has a type and a file extension of .P12.
02:46Click OK.
02:48Notice that the certificate location and password are automatically filled in for you.
02:52If you're going to be generating additional AIR applications during the session, you might want to check this option,
02:58Remember password for the session, so you don't have to type in the password over and over again.
03:04Click the Next button,
03:06and on the next screen indicate which files you want to include in your AIR file.
03:11If your application includes assets such as graphics,
03:15XML files and so on, you'll need to make sure that these items are selected. In the case of a simple application like
03:21this one where it doesn't have any extra resources, the only files that need to be included are the application descriptor file
03:27with the .XML extension and the compiled application with the .SWF extension. You don't need to include your MXML
03:35and ActionScript source files. These are already compiled into the SWF file.
03:40click Finish and your AIR application is now complete.
03:45To install the application on your desktop,
03:49double-click on the .AIR file and assuming that you already have the appropriate version of the Adobe integrated runtime installed on your system,
03:56you should now see the Application Install dialog.
03:59Click the Install button.
04:01Select whatever installation preferences you like and click Continue.
04:06After a few moments the application is installed and it should open up on your desktop. I'll double-click its title bar to
04:12expand it to full screen.
04:14Then close the application,
04:16and I'm going to minimize Flex Builder and show you that the application's icon has been added to my desktop.
04:22Now I'm going to uninstall the application.
04:26I go to the Control Panel
04:28to Uninstall a program.
04:30If you're working on Windows XP, select Add and remove programs and if you're working on a Mac, removing the application is a
04:37matter of moving to the applications folder and locating and deleting the application.
04:42I'll scroll down to the application,
04:45HTMLinFlex,
04:46double-click,
04:48and uninstall.
04:50So that's a look at how the package a Flex application for deployment on the Adobe integrated runtime.
04:56All the tools you need are integrated into Flex Builder 3 so you don't need to work with the command line tools like you do with the SDK
05:04and you can use any Flex features that you're familiar with and uncomfortable with to build your Flex application.
Collapse this transcript
4. Creating AIR Applications in Dreamweaver CS3
Installing the AIR extension for Dreamweaver
00:00In this chapter of the video series I'm going to describe how to build and deploy the AIR applications using Dreamweaver CS3.
00:07As I described in previous videos, you can build AIR applications completely using HTML, cascading style sheets and
00:14JavaScript. You don't necessarily need to include Flash-based content built in Flash or Flex.
00:21If you already have a license for Dreamweaver CS3, you'll be with the download and install the Dreamweaver
00:26extension for Adobe AIR from Adobe Systems.
00:29During the beta cycle this extension was available for download on the lab site.
00:34Once the product has been released,
00:36you'll be able to find it at www.adobe. com/products/Flex.
00:42For additional information about the extensions,
00:44you should also look on the Adobe Developer Center area, an area specifically designed for developers who use HTML and
00:51JavaScript to build AIR applications.
00:54I have already downloaded the extension file onto my desktop. Notice that it has a file extension of.MXP.
01:01The actual name of the final product release may differ.
01:04In order to install the file, first make sure you have Dreamweaver closed.
01:08Then just double-click on the file,
01:11and that will result in opening the Extension Manager application and installing the extension.
01:16During the installation process, the Adobe Extension Manager application shows you the license agreement.
01:23If you agree to the license agreement, click on the Accept button
01:26and then the extension is installed.
01:28Once the extension has been installed, you'll see this confirmation message.
01:32Click OK
01:34and then in the Extension Manager, make sure that you have Dreamweaver CS3 selected and it should show that the
01:40Adobe AIR extension has been installed correctly.
01:43The version number may change depending on which version you install.
01:46Also make sure that the checkmark under on/off is checked.
01:51Close the Extension Manager and then open Dreamweaver CS3
01:56Within Dreamweaver CS3, here's how you verify that the extension has been install. If you go to the Site menu,
02:03you'll notice that there are new menu choices labeled AIR Application Settings and Create AIR File.
02:09The initially disabled because I don't have a site open,
02:12but in next video I'll say how to start building an HTML JavaScript application that's explicitly designed for use on the AIR runtime.
Collapse this transcript
Creating a Dreamweaver site for AIR
00:00In this video I'm going to show you how to build an application based on HTML and JavaScript
00:06using the Dreamweaver extension for Adobe AIR that was installed in the previous video.
00:10If you're following along in these exercises, make sure that you've already installed the Dreamweaver extension.
00:16You'll then be ready to create a new site in Dreamweaver and then learn how to package it and get it ready for installation as an AIR application.
00:24To get started, you'll create a site definition.
00:26From the Dreamweaver menus, select Site,
00:29New Site and then set two properties. The site name and the local root folder.
00:36The site name can be anything you like, I'm going to call it, Hello from Dreamweaver,
00:43and then I'll set the local root folder to a new empty folder.
00:47Click the Browse button,
00:49go to Computer or if you're working on Windows, My computer,
00:52or if you're working on a Mac select the hard disk,
00:55and navigate to the exercise files.
00:59From there drill down into the HTML subfolder and create a new folder
01:04and name it Hello from Dreamweaver.
01:07And click Select.
01:10Those are the only two settings that you need to create for the site definition.
01:15You don't need to include remote info because this is not a conventional website where you'll be uploading the application's
01:20assets to a Web server,
01:22and you don't need a testing server because AIR applications built from HTML and JavaScript can use dynamic application
01:28pages such as those hosted by ASP.net, Cold Fusion or PHP.
01:33It can only use static HTML content.
01:36Click OK
01:38and that creates the site.
01:40Next, create an HTML page which will serve as your application's initial content.
01:45You can either create a blank HTML page, or as I'm going to do in this example, you can create a starter page based on
01:51some of the themes that are included with Dreamweaver CS3.
01:54I'm going to create a fairly complex initial page, because then when I package the application for installation as an AIR application,
02:02I'll be able to show you how to make sure all the applications and assets are included.
02:07Within the New Document dialog, Starter Page (Theme) and then select Entertainment Homepage.
02:13I'm selecting this particular sample page because it incorporates cascading style sheet files and graphics. Then click Create.
02:22Next you're prompted for the name of the file.
02:25The file extension can be either HTML or HTM and I'm going to name my file default.HTML
02:32and click Save.
02:35Next I'm prompted for where I want to place this page's dependent files.
02:39There's a CSS, cascading style sheet, file and a number of graphic files that are going be incorporated into the page.
02:46For ease of packaging, always place additional files inside a subfolder of the site rather than in the site folder itself.
02:54When you get to packaging the actual application you'll see why.
02:57I'm going to create a new folder under the site root called assets. I'll just type in the name the folder, I don't need
03:03to browse and explicitly create the folder, it will be created for me.
03:07And then I'll click Copy,
03:09and that creates the page. It also creates the Assets subfolder and all the required graphics and CSS files are created
03:17in that subfolder. Next I'll make a couple of changes to the application. I'll select the text "welcome message here" and
03:23replace it with "Hello from Dreamweaver and AIR."
03:30Now I'll go up to the website name here and replace it with some text, "my website," and if you like, you can replace the
03:36graphics or change styles, whatever you like.
03:39So that's how you basically create this site. It is just like creating a conventional website except that you don't provide
03:45any information about remote servers or testing servers.
03:48In the next video I'll show you how to create your application settings file and then test the application from within Dreamweaver.
Collapse this transcript
Creating HTML content for AIR
00:00In this video, I'm going to show you how to generate the application descriptor file from within Dreamweaver CS3, how to set some
00:07of the application settings and then how to make sure all the assets that are required by the application are packaged
00:19into the AIR installer file that will be generated. First of all make sure to save any changes to your webpages
00:19and then go to the Dreamweaver menu and select Site,
00:23AIR Application Settings.
00:25Now if you don't see the menu choice in AIR Application Settings, it means you didn't install the Dreamweaver extension for
00:31Adobe AIR. You'll want to go back and follow the steps first before you continue on with these.
00:37I'll select the menu choice and this takes me into a dialog box labeled AIR Application and Installer Settings.
00:44The settings you see here are the ones that you see in the application descriptor file.
00:48In fact, the values here are going to be transferred directly into an XML file that will be generated for you.
00:54As with creating an application using the SDK or Flex, the application ID should be a fully qualified identifier that
01:02incorporates your organization's domain reversed. So for instance lynda.com becomes com.lynda.
01:08I'll set my ID to com.lynda.HellofromDreamweaver.
01:13The version number is up to you, you can set it to a value of one, or if you want to indicate that it's an application
01:19still in development, you can set it to a point release such as. 5.
01:24You must set the initial content.
01:26The initial content for an application built with HTML and JavaScript is an HTML file.
01:32Click the Browse button
01:34and select default.html, the application file,
01:38and click Open.
01:39There are many other properties that you can set here. I'll describe those in later videos when I go through the
01:44application descriptor file in detail.
01:46In the Installer settings section, you need indicate which files should be included in the AIR install.
01:53You can add individual files by clicking the plus button or by clicking the folder icon, you can add entire folders to the list.
02:00I'll click the folder icon
02:02and I'll choose the assets folder
02:05and click Open
02:06that I'll click Select.
02:08And that adds the entire contents of the Assets folder to the application installer. This is why I encouraged you when
02:15creating the file to put all the graphics, cascading style sheets and so on in subfolders of the site rather than in the site folder itself.
02:24In the Program menu folder setting, you can indicate where you want the default installation folder.
02:29For now, we don't need that,
02:31and in fact we've set all the required properties.
02:34The file name, the ID, the version.
02:36The initial content and the files we wanted to include.
02:40Click Save,
02:41and that creates the application.XML file.
02:45Over in the Files panel, you'll see that file has now been created and you can double-click to open it.
02:51The application descriptor file includes all the same settings in exactly the same format as when we created the same
02:57file for the SDK or from Flex Builder.
03:00One difference that you might notice on my screen is that the XML namespace in the application tag has been set to 1.0.M6.
03:09This indicates that this application is going use a beta version of the Adobe integrated runtime because the version of
03:15the Adobe integrated runtime that this application requires at the moment is Beta 3.
03:20Once the product goes through initial release the namespace should be updated to eliminate the d.M6 at the end.
03:26Now to test the application, I'll close the application.XML file,
03:31return to the menu and select Site,
03:34AIR Application Settings again.
03:38Over on the right under the buttons, you'll notice the Preview button.
03:41This is how you test the application from within Dreamweaver.
03:45I'll click the Preview button.
03:47The application is packaged and shown in an AIR window, and that's how you test the application. Notice that as I move the
03:54cursor over the hyperlinks that the cascading style sheet settings are working correctly, those are hover settings in the CSS,
04:01and any hyperlinks that I may have created to go to other pages would be operational as well.
04:07Now in the next video, I'll show you how to package the application from within Dreamweaver CS3 and get it ready for installation.
Collapse this transcript
Deploying an AIR application from Dreamweaver
00:00In this video I'm going to describe how to generate an application installer from a Dreamweaver CS3 site.
00:06In previous exercises I showed you how to install the Adobe integrated runtime,
00:11the Dreamweaver extension for Adobe AIR
00:13and I showed you how to set up the Adobe AIR settings for the application.
00:17Now I'll generate the installer file from within Dreamweaver.
00:21From the Dreamweaver menu, select Site, AIR Application Settings.
00:26Notice that there's also a menu choice labeled Create AIR File. If you've already set up your digital certificate during
00:32the session, you can use that many choice directly. Otherwise, you need to go through the Application Settings dialog.
00:39Now set up your digital certificate.
00:41If you already have a self-signed certificate or a certificate that you've purchased from one of the security vendors,
00:47you can click the Set button next to Digital Signature and then select your certificate and provide a password.
00:53If you need to create a digital certificate from scratch, click the Create button,
00:57put in the publisher name,
00:59and set the password.
01:01You must have the password in the future to reuse the certificate. Then indicate what you want to name the certificate.
01:10Click the Browse button and place the certificate in your site root.
01:14I'll name it mycertificate.PFX.
01:18Click the Save button,
01:20and then click OK.
01:23After a moment you'll get a confirmation message indicating that the digital certificate file has been created. Click OK
01:29to return to the Digital Signature dialog,
01:31and then type in the password for the certificate you just created.
01:35If you're going to be generating multiple AIR files,
01:39you can select the option Remember password for the session.
01:42Also if you don't have direct access to the digital certificates for your organization,
01:47you may need to create an intermediate AIR package, which has a file extension of AIRI,
01:53and then send a package to the person who actually is in charge of applying the digital certificates.
01:59I'll click OK to indicate that I'm ready to create the AIR file
02:03and then I'll click the button Create AIR File.
02:06After just a few moments, you should get a confirmation message indicating that the operation succeeded.
02:11If you have any problems, check to make sure that you entered the password correctly and also make sure that the certificate is in the location you indicated.
02:19Click OK
02:21and you should see the file HellofromDreamweaver.AIR created and displayed in the Files panel.
02:28Now to do the installation, follow the same steps as before. I'll double click on HellofromDreamweaver.AIR,
02:35I'll be presented with the Application Install dialog.
02:38Now if you have any problems at this point, it may be an issue of the Adobe integrated runtime version that's installed on your computer.
02:45I'm assuming that the runtime is already been installed before I tried this operation.
02:50And if you see this screen, then you should be in good shape.
02:53I'll click the Install button.
02:55I'll select my installation preferences and click Continue to install the file.
03:01Once the application is installed, it starts up automatically.
03:05I'll close the application,
03:06close Dreamweaver,
03:08and I should now see the HellofromDreamweaver icon appear on my desktop.
03:13I'll double-click it to run the application again,
03:15confirming that the application is been correctly installed.
03:19I'll close the application
03:21and now I'll uninstall it exactly as I have with previous applications.
03:25If you're working on Windows, open the Windows start menu
03:28and go to the Control Panel.
03:30If you're working on Vista, select Uninstall a program and if you are working on Windows XP, select Add or remove programs.
03:37If you're working on a Mac, it's a lot easier. You just go to the Applications folder, to the location of the installed
03:43application and delete it.
03:45I'll click Uninstall program,
03:47navigate to the application HellofromDreamweaver,
03:50and double-click to uninstall and confirm.
03:54And the application is removed from my system.
03:57So that's how you packaged application from within Dreamweaver CS3.
04:01The steps are pretty much the same is with the SDK or with Flex Builder and you can follow all the steps from right there inside Dreamweaver.
Collapse this transcript
Programming with JavaScript
00:00In this video I am going to describe how to integrate JavaScript programming into your applications built from HTML.
00:07The steps I'm going to describe work whether you work with Dreamweaver or with the software developers kit.
00:12You can execute any JavaScript that would normally be handled by a browser within your applications.
00:17In addition, there are some pre-built JavaScript libraries that are a part of the software developers kit that you
00:23can use to implement particular bits of functionality.
00:26Dreamweaver improves that development experience by being able to recognize the objects that are a part of those
00:32JavaScript libraries and providing good code coloring, code completion and other tools.
00:38For this demonstration I am going to create a brand-new site in Dreamweaver CS3.
00:43From the menu select Site, New Site.
00:46Name the site, AIRWithJavaScript
00:51and place it in a new local root folder.
00:54Place the new folder in the AIR Essential Training.HTML folder
00:58and name the new folder, AIRWithJavaScript.
01:04After creating the folder,
01:06click Select
01:07and then click OK.
01:10Next create a brand new HTML page.
01:13Save the HTML page in the news site's root folder and name it default.HTML
01:19and click Save.
01:21Then go into Design view.
01:23Press Control + 1 to add an h1 tag set and type in heading for the application of AIR with JavaScript,
01:31and press Enter.
01:33Now go back to Code view.
01:35Place the cursor inside the head section of the application.
01:39Any JavaScript code that you write should typically be placed within script tags
01:43that are defined within the head section of the HTML page.
01:46Alternatively, you can create JavaScript functions in separate external JavaScript files with the .JS extension and link them in with script tags.
01:55I'm going to create a script tag set here
01:58and I'm going to set its type to text/JavaScript.
02:03And then creating an ending script tag.
02:06Within the script tag you can define as many functions as you need.
02:09The syntax for declaring a function in JavaScript is the same is in the browser.
02:13You put in the word function and then the name of your function.
02:17I'm going to create a function called to sayHello.
02:21Now, if you're coming from a Flex development background working with ActionScript 3,
02:25there are a couple things that aren't in JavaScript that you do use an ActionScript 3.
02:29In ActionScript 3 for instance, you always put in access modifier before the word function such as public, private, protected or internal.
02:36You don't do that in JavaScript. And after the function name in ActionScript 3, you typically declare a data type
02:43that will be returned. In JavaScript that's not required.
02:46Other than that, the syntax of the two languages is very similar.
02:50Within my custom function sayHello,
02:52I'm going to call commonly used method of the Window object named alert. The window.alert method takes a simple string.
03:03I'll type in the string "Hello from AIR,"
03:06and then I'll go down to the body of the HTML page and inside the paragraph tags that have been created when I was in Design view,
03:13I'll remove the nonbreaking space.
03:16Then I'll create an input tag.
03:19I'll set its type to button and the value, which is the value that's displayed on the face of the button, to "Click Me."
03:27Next I'll add an onClick event handler.
03:30Again, if you're coming from Flex, this a little different than programming in that environment. In MXML you would put in an event handler named simply click.
03:39In JavaScript, it's onClick.
03:41Now we'll call my custom function, sayHello. Make sure to include the opening and closing parentheses at the end.
03:48I'll put in the closing greater than symbol and Dreamweaver adds the extra slash at the end to make the tag compatible with the XHTML architecture of the state.
03:58I'll save the change,
03:59and now I'm ready to test it in AIR.
04:02I'll go to the Site menu.
04:05From there I'll select AIR Application Settings.
04:09I'll set the ID to com.Lynda.AIRWithJavaScript, then click Browse to set the initial content and select default.HTML.
04:20Those were all the settings I need.
04:22Now I'll preview the application,
04:25and when the application appears, I'll click the button,
04:29and there's the resulting dialog box produced by the alert method.
04:33So that's the simplest sort of JavaScript code.
04:36I'll close the application and return to Dreamweaver and then click Save.
04:41Now in next video I'll describe how to use some of the JavaScript library functionality that's included with the software
04:47developers kit and integrate that functionality into applications that you build in Dreamweaver.
Collapse this transcript
Integrating JavaScript Libraries
00:00In this video I'm going to describe how to integrate some of the JavaScript functionality that's a part of the software developers kit.
00:07If you're following along with these exercises, you must have first downloaded the softer developers kit from Adobe and
00:13installed the Dreamweaver extension for Adobe AIR.
00:15I'll be demonstrating this in the AIRWithJavaScript site that I created in the previous video.
00:20First of all, the actual JavaScript files that we'll be using are part of the SDK, the software developers kit.
00:27When you downloaded the SDK, it was an archive, a ZIP file, which you then simply unpacked somewhere on your system.
00:33I have opened the folder AIR SDK in which I extracted the software developers kit files
00:38and from there I'll drill down to the Frameworks subfolder.
00:42There are three JavaScript files included in the Frameworks, including AIR Aliases, AIR Introspecter and AIR SourceViewer.
00:51I'm going to demonstrate functionality that's a part of the AIR Aliases.JS file.
00:56I'll select the file and copy it to the clipboard.
00:59Then I'm going navigate back to the AIR Essential Training folder.
01:04From there down to HTML,
01:06and then into the AIRWithJavaScript folder in which I'm creating the application.
01:11And I'll paste the file into the location then I'll close the window and return to Dreamweaver.
01:16Over in Dreamweaver, I'll click the Refresh button to show that the file is there.
01:21Now to integrate the functionality of this JavaScript file into the application, I'll return to the file default.HTML,
01:28which is my application's initial content.
01:31Then within the head element of the file,
01:33I'll add a script tag and I'll set its SRC attribute
01:38to the location of the JavaScript library I want to include.
01:42I'll also set the type property to text/JavaScript
01:48and then I'll be sure to put in the closing script tag to make sure that the elements are well formed.
01:53The AIR Alias's library creates a set of aliases that allow you to easily access common functionality in the AIR libraries.
02:01I demonstrated one aspect of this in an earlier video when I used the AIR object and called the trace method.
02:07Now in this application I am going to use other features of the AIR object.
02:12I'm going to create another button down here.
02:17I'll declare it as an input control with a type of button.
02:21A value of "Click to Navigate,"
02:25and an onClick event handler that calls a custom function I'm about to create called navigateNow. Next I'll go up to the
02:34script section where I'm creating my functions. I'll press the F4 key to expand to full screen so we can see as much code as possible.
02:41And then I'll add in the function and I'll name it navigateNow.
02:48Within the function, I'm going to call a method of the AIR object called navigateToURL.
02:55Notice that as I type in the name of the method, Dreamweaver is helping auto-complete the code. It's also providing
03:03really great color coding, so I can see exactly what the structure of the code is that I'm putting in.
03:08The purpose of the navigateToURL method is to cause navigation to a website of your choice.
03:15It takes as its one required argument a request, which is an instance of an object called URLRequest.
03:22You create the URLRequest object using this syntax, new AIR.URLRequest.
03:30And then within parentheses pass in the location that you want to navigate to. I'm going to put in http://www.adobe.com
03:42and then put in two closing parentheses. The first to close the constructor method call for the URLRequest object,
03:49and the second to close to navigate URL method.
03:52I'll save my changes and now we're ready to test the application.
03:57If I try to run this application in a standard web browser, it won't work because the AIR object is, referred to with line 15,
04:04is only available when you're running within the runtime.
04:08So I'll go up to the menu and select Site,
04:11AIR Application Settings.
04:14I set the ID of the application already in the previous video to com.lynda.AIRWithJavaScript,
04:20andI have already set the initial content to the default.HTML file.
04:24I also need to make sure that I include all of the files that are part of the application. This includes the JavaScript
04:31library that I copied into the folder, so I'll go down to the included files,
04:36click the plus button and double-click on AIR Aliases.JS to add it to the application.
04:43Now I'm ready to preview and test.
04:46I'll click the Preview button.
04:48The application pops up.
04:50I'll click the Click to navigate button
04:53and the URL that I requested opens in a web browser.
04:57So that's just a very small part of the functionality that's available in the Adobe integrated run-time JavaScript libraries.
05:03There's extensive documentation for all the tricks and tools that are available in these libraries, but the tools are
05:09extensive and detailed and there's no replacement for going through the documentation when you need to learn how you use a particular feature.
Collapse this transcript
5. Creating AIR Applications in Flash CS3
Installing the AIR extension for Flash
00:00In this chapter of the video series I'm going to describe how to create and deploy AIR applications using Flash CS3 Professional.
00:07If you want to follow along with these exercises
00:10you'll need to have installed Flash CS3 on your system,
00:13either on a Windows or Mac platform.
00:15To get started, first you need to make sure did you have the most recent version of Flash CS3 Professional, version 9.0.2.
00:23If you're not sure whether your system is upgraded,
00:25you can go to the Flash menu to the Help menu and from there select Updates.
00:30Flash will scan the Adobe website and make sure that it has all recent updates.
00:35Alternatively, you can go over to the Adobe website to this URL,
00:39www.adobe.com/support/Flash/downloads.html.
00:48On this page you'll find a downloadable copy of the update for both Windows and the Mac.
00:53To install the update in this fashion, download the update for your operating system and then make sure that you've closed
00:59Flash and any browser windows before you run the update.
01:03Once you've upgraded your copy of Flash CS3 Professional to 9.0.2,
01:07you'll be ready for the next installation step.
01:11I've already downloaded the Flash CS3 AIR extension application.
01:15This is another application updater so once again before you run it, you must have closed Flash CS3 Professional and any browser windows.
01:23To install the update on Windows, just double-click on it and follow through the prompts.
01:27The same thing is true on the Mac; just follow through the prompts until the installation is complete.
01:32From this screen, the Adobe Software Update dialog and click Next.
01:37And after a few moments the patch will have been installed.
01:40Once the patch has been completely installed, you can re-open Flash CS3 Professional.
01:46And here's what to look for to make sure that the update happened correctly.
01:50On the initial welcome screen, you'll now see a link that allows you to create a Flash file for Adobe AIR.
01:57You'll also find items under the Commands menu for AIR Application and Installer Settings and creating an AIR file.
02:03So if you follow the steps, and you have your copy of Flash ready to go,
02:08you can go onto the next set of videos and learn how to create Flash-based content and package it as an Adobe AIR application.
Collapse this transcript
Creating an AIR application in Flash CS3
00:00In this video, I'm going to describe how to create an AIR application from scratch using Flash CS3 Professional.
00:06If you're following along these exercises, you must have first updated your copy of Flash to version 9.0.2 and
00:12installed the AIR updater for Flash.
00:15If all this is been done correctly on the Flash welcome screen under Create New, you'll see a link labeled Flash File (Adobe AIR).
00:22To get started, click that link to create a new file.
00:26You'll see an informational dialog box that tells you that when you test your movie in Flash you'll actually be running it in the AIR environment.
00:33Click OK to clear this dialogue,
00:35and then save your new Flash file.
00:37Select File, Save As,
00:40navigate to a folder in which you'd like to save it and give it a name of HelloWorld.FLA.
00:45I'm placing the file in the Flash folder within my exercise files area, AIR Essential Training,
00:52and then clicking Save.
00:54Here are some critical settings that get set up when you first create this file.
00:58Go to the menu and select File, Publish Settings
01:02and then within the Publish Settings dialog, click on Flash.
01:06You find that the version is set to Adobe AIR 1.0.
01:10This is an application that specifically targets the Adobe integrated runtime
01:14and is not designed to run on top of the Flash Player. Also notice that the ActionScript version is said to ActionScript 3.0
01:20and a selector for the ActionScript version is disabled.
01:23This is because applications running on AIR must use ActionScript 3 and can't use previous versions of the language.
01:30Click OK to close the dialog and now we're ready to add some content.
01:34Go to the layers and add two new layers.
01:40Name the bottom layer Labels,
01:44name the second layer Animation and name the top layer Actions.
01:51Now go to the Labels layer.
01:54Click the Text tool in the toolbar
01:57and then click and drag a text field across the top of your application.
02:02Position the text field around the center,
02:04set its properties to Arial, with the size of 36. Nice and large.
02:10And then set the text in the text field to "Hello from AIR!"
02:15If your text comes out in a slightly different color, no problem.
02:19Now select the Selection tool,
02:21click anywhere on the Stage and go down to the Properties panel.
02:25Click the Background color picker
02:27and choose a nice color that you like.
02:30Go back to the layer's presentation, to the Animation layer.
02:34Right-click and select Lock Others.
02:37We're about to add content to this layer and we want to make sure it goes into the right layer.
02:42Now we're going to add a very simple animation to the application.
02:46Go over to the toolbar and click the Oval tool. If you don't see the Oval tool, click and hold on the rectangle or whichever
02:53tool appears in this position, and then select the Oval tool.
02:56And then move down to the bottom of the application.
03:00Hold down the Shift key to make sure that you're adding a perfect circle and then click and drag to place the object on the screen.
03:07Use the Selection tool and double-click the object,
03:10then right-click and select Convert to Symbol.
03:13This will take the drawing that we just created
03:15and change it into a symbol in the library.
03:17In the Convert to Symbol dialog box set the symbol type to Graphic and name this grBall.
03:25And click OK.
03:26Next, go up to the Timeline,
03:28place your cursor in Frame 24, right-click and select Insert Keyframe.
03:33Then go down to the Stage area
03:36and hold down the Shift key and click and drag the ball to the right side of the Stage, until it's just off the Stage.
03:44In the first keyframe, the ball should be on the left. In the last keyframe, it should be all the way off the Stage.
03:51Then click into the center of the Timeline, between the two keyframes.
03:54Go down to the Properties panel,
03:56open the Tween selector and choose Motion.
03:59And that will create a very simple animation.
04:02Go back up to the Timeline.
04:04Go to frame 24 of the Labels layer,
04:07right-click and select Insert Frame.
04:09This extends that layer out to the end of the Timeline so that the label will be visible throughout the running of the application.
04:15So that's your very simple Hello World application in Flash.
04:19Test the application by pressing Control + Enter
04:22and you should see the application present the label and you should see the animation run across the bottom of the screen.
04:28Now this is obviously the simplest possible Flash application,
04:32but in next video, I'm going to say how to take a fairly complex Flash application that incorporates video and sound
04:39and show you how to take existing content and convert it into an AIR application very easily.
Collapse this transcript
Converting existing Flash content to AIR
00:00In this video, I'm going to describe how convert existing Flash content to an AIR application in Flash CS3 Professional.
00:07To demonstrate this, I'm going to use an application from Adobe Systems.
00:11It's been a popular application over the last number of years that's used to demonstrate some of the advanced capabilities of Flash Player.
00:18it's called the Flash Video Gallery.
00:20And there's a version for ActionScript 3 that you can download from the Adobe website. Its current location is this URL,
00:27www.adobe.com/devnet/Flash/articles/video_gallery.html.
00:38This article contains a complete description of how the video application is built and at the bottom of the article,
00:44there's a link from which you can download the sample files.
00:47The name of the ZIP file. You'll download is AS3_Flash_video_gallery.ZIP.
00:54Now for any reason you can't find this file to a search on the Adobe website or on Google for Flash Video Gallery ActionScript 3.
01:03It is critical that any content that you decide you want to convert for AIR must use ActionScript 3.
01:09Older Flash content that uses ActionScript 1 or 2 will not be convertible and less you import the code and make it all ActionScript 3 compatible.
01:17I'm going to demonstrate this by unpacking this ZIP file and placing the contents in a folder within my exercise files directory.
01:25I'll right click on the ZIP file
01:27and select Extract All.
01:29And then I'll browse to my exercise files area,
01:32which is under the C drive, under AIR Essential Training,
01:35and I'll place this under Flash.
01:38Within the Flash folder, I'll create a new folder called VideoGallery.
01:43Then I'll select that folder and click OK.
01:46So the location on Windows will be C:\AIREssentialTraining\Flash\VideoGallery.
01:54If you're working on a Mac, place the files in any folder you like and I recommend putting them somewhere in your exercise files area.
02:01I'll click Extract to finish the extraction.
02:04It will take a few seconds because they're quite a few files here, including some video files that we'll be presenting in the application.
02:11Then within the folder, I'll navigate down to the contents
02:15and I'll double-click on the file FlashVideoGallery.FLA to open the source file for this application.
02:21Here's what the application does. Before I convert it to AIR, I'll run it.
02:25Press Control + Enter and run the application,
02:29and you'll see that this is a highly interactive application.
02:32As the user moves the cursor over each of the cells,
02:35a video starts playing.
02:37And then when you click to select a video it actually plays in the preview screen on the right.
02:42So I'll click another one, show that video, click another and so on.
02:46So here's how you convert a Flash document to AIR.
02:49From the menu, select File,
02:52Publish Settings.
02:53Then go to the Flash tab of the Publish Settings dialog and change the version from Flash Player 9 to Adobe AIR 1.0.
03:02As I mentioned in the previous video, at this point the ActionScript version selector will become disabled.
03:07Is it because you can't write code in ActionScript 2 and port it to AIR.
03:12I'll click OK to save the change.
03:14Next I'll go into the application descriptor for this application.
03:18To get into the application descriptor properties,
03:21go to the Menu and select Commands,
03:23AIR - Application and Installer Settings.
03:26It takes a few moments because a publication process has to happen in the background.
03:31If you see any prompts asking if you want to override existing content, click Yes.
03:36Once the AIR - Application and Installer Settings dialog appears, you can make any changes to the way you want to present your content.
03:43For instance, the default ID is com.adobe.example.FlashVideoGallery.
03:48This is a application that was built by Adobe Systems, I'm going to keep that ID in place.
03:53Also if there is any content that you want to include in the application,
03:57 add the files at the bottom of the dialog.
03:59Click OK to save your changes,
04:01and now to run this Flash document as an AIR application press Control + Enter.
04:07And the application is now running in the AIR runtime.
04:10Notice that I can once again move the cursor over each of the cells, select an item and I'll be able to see the video
04:16appear in the screen on the right.
04:19None of the functionality has been disturbed in any way.
04:22The point here is that what ever you know how to do in Flash, you know how to do in AIR,
04:26because every component in the Flash environment works under the Adobe integrated runtime.
04:31But there's an added features that are also available to you, just like there are for HTML and Flex developers.
04:37You'll be able to take advantage of all the ActionScript libraries that allow you to read and write to local system
04:43files, save data locally in the embedded database and control your Flash environment using all of the AIR APIs.
Collapse this transcript
Deploying an AIR application from Flash
00:00In this video I'm going to describe how to deploy an AIR application from within Flash CS3 Professional.
00:06In previous videos I showed you how to create an application from scratch,
00:10and how to convert existing content to AIR.
00:12Now I'm going to create the installer package,
00:15using the features of the updater for AIR that we installed previously.
00:19The first step is to open the Flash document that you want to deploy as an AIR application.
00:24Then from the Flash menu, select Commands,
00:27AIR - Application and Installer Settings,
00:29and set the file name, the name and the ID.
00:32As before, I'm using a unique identifier of com.lynda.HelloWorld.
00:37By default, you might see, com.adobe.examples.HelloWorld.
00:41If it's your own application, you should change the prefix to reflect your organization name.
00:46Down below, you can select a custom application descriptor file.
00:50If you've already created an application descriptor file manually, you can simply choose it from here.
00:55Next set your digital signature.
00:58Click the Change button,
00:59and then if you already have a digital certificate, select it.
01:02Otherwise, click the Create button.
01:04In this version of the Create dialog, you must fill in all values, including the publisher name, the organization unit
01:11and the organization name, so I'll fill these values in. I'm going to be a little bit lazy and fill in the same values three times.
01:19And then I'll set the certificate password by typing it in twice.
01:24And then I'll browse for the location where I want to create the certificate.
01:27I'll navigate to the exercise files location, which on Windows is under C:/AIREssentialTraining.
01:34From there, to the Flash folder where I'm creating the application,
01:37and then I'll click OK.
01:38Then I'll click OK to create the certificate.
01:42After a moment I get the confirmation that the certificate has been created.
01:46I'll click OK and return back to the digital signature dialog.
01:50Now I'll enter the password again.
01:53Click OK,
01:55and then click the Publish AIR File to create my installer.
01:59You should now get a confirmation that the AIR file has been created.
02:02Click OK
02:03and click OK again.
02:05Now, the AIR file will been created in the same folder in which the Flash document was created.
02:10So I'll navigate once again to the location of my exercise files.
02:14From there to the Flash folder,
02:16and there's my HelloWorld.AIR file.
02:19I'll double-click to install it.
02:21This process should look pretty familiar now; it's the same as happened with this software developers kit,
02:26with Dreamweaver and with Flex.
02:28I'll click Install and set my installation preferences
02:31and click Continue to install the application.
02:34The application runs automatically upon completing the installation.
02:38I'll close the application,
02:40Close all windows.
02:42Close Flash.
02:45I'll then come back to the desktop.
02:47Notice that when you create a new AIR file using Flash, application icons are provided automatically. I'll describe
02:54how to modify or select other icons in a later chapter.
02:57I'll run the application from the desktop, showing once again that the installation was successful.
03:03I'll close the application
03:04and then following steps that I've followed before, I'll uninstall the application. On Windows, I'll go to the Control Panel.
03:11On Vista, I'll select Uninstall program.
03:14If you're working on XP, select Add or remove programs.
03:17Then locate the HelloWorld application and double-click to uninstall.
03:21If you're working on the Mac, simply navigate to the Applications folder.
03:26Find your HelloWorld folder and move it to the trash.
03:29So you can see how easy it is to take Flash content, package it and set up for installation as an AIR application.
03:36This will be a cross-platform AIR application, like all the others, running easily on either Windows or on the Mac,
03:43and you can build into that application whatever features you know how to build using your skills in Adobe Flash.
Collapse this transcript
6. Setting Application Properties
Understanding the application descriptor file
00:00In this chapter of the video series, I'm going to describe some of the details of the application descriptor file,
00:06the file that sets properties for the ADL, the debug launcher, and the ADT, the developer tool, that are use to test and package your AIR applications
00:14regardless of whether you're working with the software developers kit, Flex Builder, Flash CS3 Professional or Dreamweaver CS3,
00:22you'll start off with the default application descriptor file.
00:25The version I'm displaying on the screen right now comes from the Samples folder
00:29and represents a completed application descriptor file with various settings.
00:34In this video, I'm going to show you four different versions of the file and then I'll talk about some of the key properties,
00:40and then later videos I'll get into some of the other details.
00:43This version of the file, as I said, is a completed example and it comes with the software developers kit.
00:48The next version of the file HelloWorldApp.XML came from Flash CS3 Professional.
00:53Notice that the namespace in this version of the file has a suffix of .M6.
00:59That would indicate that the AIR application is generated with this file requires the Beta 3 version of the Adobe integrated runtime.
01:06If for instance I wanted to upgrade this application and make it require the final public release of AIR 1.0,
01:12I would change the namespace by removing the .M6 from the end.
01:16I'll leave that alone for compatibility with the current version of the Flash CS3 updater that I'm using and recording this video.
01:22Notice that there are a lot of commonalities between the version with the SDK and the version with Flash.
01:27You always, for instance, set an ID element, the unique identifier for the application,
01:32and you always set a version and a filename.
01:35The description and copyright, however, can be left out,
01:37and in the Flash version of the file are simply left blank.
01:40The Flash version of the file sets icon values.
01:44These are the names of graphic files that are used in different circumstance to visually represent the application.
01:49For instance, one version is used as a desktop icon, one is used in system trays and so on.
01:54Here is the version of the file that is created in Dreamweaver. It is probably the most concise.
01:59It has a file name, a custom update UI, an ID and a version. Notice that it doesn't include a title element in the initial window element.
02:06That's because when you're working in HTML,
02:08the title of the initial window is taken from the title element in HTML.
02:13And finally here's the version of the file that's built in Flex Builder.
02:16When you create a new AIR application using Flex Builder,
02:19you get a completed file with all the optional elements commented out.
02:24It's up to you to go through and uncomment the elements that you want to use and fill in their values.
02:29So it doesn't really matter how you create the application descriptor. It always has the same basic structure but some of
02:35the rules are slightly different depending on whether you're building your AIR application in Flex Builder, Flash CS3,
02:47Dreamweaver or with the software developers kit.
02:49In the next couple of videos, I'm going to take a look at a couple of specific properties in the application descriptor file and describe how to use them.
Collapse this transcript
Setting basic application properties
00:00In this video, I'm going to describe some of the basic properties that you set to control application dimensions and position.
00:06I'll also talk about the namespace setting and show how it affects running an application from within one of the
00:11development tools versus running it from the command line with the software developers kit.
00:16I'll be working with the application I created in Dreamweaver in an earlier chapter.
00:20I'll open the file default.HTML in Design view
00:23and show you that it contains a simple h1 tag with some text and a couple of buttons.
00:28The buttons, respectively,
00:30use a little bit of generic JavaScript to show an alert window
00:34and then use the AIR Alias to navigate to a URL in a browser.
00:38If I run the application from within Dreamweaver, it looks like this.
00:41I'll go to the Site menu,
00:43to AIR Application Settings,
00:46and then preview the application.
00:49I'll click the Click Me button to show the dialog box produced by the alert method
00:53and then click Navigate to open a browser and navigate to website.
00:59OK, let's take a look at the application descriptor file.
01:02In Dreamweaver, there's a dialog box that you can use to set many but not all of the properties in the application descriptor file.
01:08For example, if I set the application dimensions, the width and height, using this dialog box. I'm just changing the
01:15contents of the application descriptor file.
01:17So as an experiment, I'm going to set this to a width of 300 and a height of 200.
01:23Then I'll preview the application to see what it looks like.
01:26It's a little smaller than before. Then I'll click Save.
01:29Then up come back and open the application .XML file
01:33to show that all Dreamweaver is done is to modify the XML file for me.
01:37Now when you're working in Dreamweaver, one of the things you'll run into is that you can either be working in the application.XML file open in the workspace,
01:44Or you can go into the application settings dialog, but you can't do both at the same time.
01:49If you try to, for instance, I'll go to the Site menu
01:52and select AIR Application Settings,
01:54and I'll get this error message.
01:56"Please close the application.XML document before running this command."
02:00So you can either edit the file manually
02:03or you can go through the Application Settings dialog but you can't do both at the same time.
02:08If you want to work in the application descriptor file manually,
02:11you can then try keeping it open in Dreamweaver and then using the command line tools to launch an test your application.
02:18One of the advantages you get out of this is debugging. When you have debugging tracing statements for instance and
02:24you run the application from the command line, you'll get the tracing statements on the command line.
02:29So that's what I'll try this time. I'll manually change the height and width to 400 and 600,
02:35and I'm also going to change the namespace of the application.
02:38The version of the default namespace when it's generated with the current version of Dreamweaver and beta has the .M6 extension.
02:45I'll remove that value to make this application compatible with the final release version, which is what I'm running on the command line.
02:53Then I'll come to the command line
02:54and I'll type ADL application.XML.
02:59Run the application and you'll see it's much larger than before.
03:03Now I'm going to change the application title.
03:05I'll close the application,
03:07come back to Dreamweaver,
03:09go to the HTML file,
03:12locate the title element,
03:14and I'll change it to "Hello World from Dreamweaver,"
03:20save the change,
03:22switch back to the command line,
03:25and run the application again from the command line, and there's my title.
03:29So you can see that certain properties get set in the application code itself and certain properties get set in the application descriptor.
03:36There's another set of properties you can set easily in the application descriptor file. The X and the Y properties of the initial window.
03:44Now the version of the file that's created in Dreamweaver doesn't contain these properties,
03:49and if at any point your not sure what the names of the properties are in, you don't have Dreamweaver help you fill them in,
03:54you can go back to the sample version that comes with the SDK. So I'm going to go re-open that file,
04:00is called descriptor-sample.XML,
04:03and then I'll scroll down to the initial window,
04:05and show that there are X and Y properties being set right here.
04:09I'll copy those to the clipboard,
04:11come back to the application.XML file,
04:13and then paste them in.
04:18To show the behavior the X and Y properties, I'll set them to values of zero.
04:23I'll save the changes,
04:24come back to the command line,
04:26and run the application again.
04:28And notice that the application appears in the upper left-hand corner of the Windows interface.
04:33I'll close the application,
04:35come back to the descriptor file, and change these values to 300 pixels each, which means position the window
04:42300 pixels from the top of the screen and 300 pixels from the left, save the change,
04:47come back, run the application,
04:49and now the application appears in that position.
04:51See, you can set the application's position easily using the X and Y properties.
04:56I'll close the application, come on back to Dreamweaver and so on.
05:00So as you set each of these properties, you can either run the application from right within Dreamweaver or you can run
05:05it from the command line using the softwood developer's toolkit command line tools.
05:09My preference is to switch back and forth and run from the command line
05:13because of the additional debugging capability that you get with the command line tools.
Collapse this transcript
Using application icons
00:00In this video I'm going to describe the use of custom icons that you associate with your AIR application when you create
00:06the installer for the application.
00:08Each AIR application supports four icons of different sizes.
00:12There are samples of these icons included with the AIR software developers kit.
00:17If you've installed the AIR SDK and you'd like to take a look at the sample graphics, go to the SDK's Samples folder.
00:24From there, go to the Icons subfolder
00:26and you'll find four files of different sizes.
00:29When you build an AIR installer, you can specify four different icons used in different circumstances.
00:34The smallest icon, for instance, is presented in the upper left corner of the application as its control menu icon.
00:41Other sizes are used in different circumstances. For instance, if you create a desktop shortcut or alias,
00:46the 48 pixel version is used in that circumstance.
00:50If you want to create your own custom icons you can create them in any graphic application.
00:55Ideally you should set them up as PNG or TIF files with transparency so that they show up correctly against the background
01:01of an operating system screen.
01:03Now I've created my own set of custom icons to show you how this works.
01:07If you go to the exercise files folder, in my case, C:\AIREssentialTraining,
01:13and from there go down to the Assets folder,
01:15you'll find an Icon subfolder there.
01:18Open that, and you'll find four files.
01:21Each of them designed as the perfect icon for a HelloWorld application.
01:25You can tell immediately that I'm not a graphic designer- this definitely qualifies as programmer art -
01:30but these files will suffice to show you how this works.
01:33I created these files in Adobe Fireworks CS3.
01:37So if you have that product, you can open them up there.
01:39But I want to make the point that these icon graphics can be created in any graphic application with which you're comfortable.
01:45Now to use the icons I'm going to copy them to the clipboard. I'll take the whole folder,
01:51and copy it,
01:52and then I'm going over to Flex Builder.
01:55The Icon Architect works exactly the same for any AIR application,
01:59regardless of what he build the application Flex, Dreamweaver, Flash or with the SDK.
02:04You and the icons to your folders assets,
02:07and then you go into the application descriptor XML file and describe the files that you want to use.
02:13I'm going to paste the files into the source root of my application.
02:17Notice that with Flex Builder you can copy and paste between the operating system and the Flex Navigator view quite easily.
02:23And then I'll open up the application descriptor file.
02:26The name of the file is HellofromFlexAndAIR-app.XML.
02:31And then I'll scroll down for the bottom of the file.
02:34Notice that in this version of the application descriptor file,
02:37there's an icon element that's been commented out.
02:40The first step to using the icons is remove the comments,
02:44and then fill in the elements for each size graphic.
02:48To make sure I to get this right, I'll go over to the Icons folder in the Flex Navigator view,
02:53and then for each of the items I'm going to carefully typing the name of the files in each location.
03:00I going to put in the directory name "icons" in each case, and then the name of the file, HelloWorld16x16.PNG.
03:08I'll copy that one.
03:12And then paste it in and change the measurements for each one.
03:21The second one is for the 32 pixel dimensioned icon,
03:25for the next one for the 48,
03:29and the last one for the largest version, that's 128 pixels square.
03:37I'll save the changes and then re-build the AIR application install.
03:41I already have an AIR file that I created previously.
03:44So I'll delete it.
03:47And then from within Flex Builder, I'll create my AIR installer by going to the Project menu and selecting Export Release Build.
03:54I'll go through the steps including selecting a security certificate and entering the password.
04:01Then on the next screen I'll indicate which files I need to include in the exported AIR file.
04:05Notice that now I have to include the icon files
04:08and Flex Builder does this automatically for me.
04:12I'll click Finish,
04:13and after just a moment my new AIR file is created.
04:16I'll double-click it to install it in the operating system.
04:20I'll walk through the install process
04:23and as soon as the installation is complete, the application opens on the screen.
04:28Notice that my icon is now displayed as part of the application interface.
04:32I'll close the application,
04:34go back to the desktop and show that a larger version of the icon is included in the desktop shortcut.
04:40Now I'll uninstall the application,
04:43in Windows, I'll go to the Control Panel.
04:45Select Uninstall a program or Add or remove programs in Windows XP,
04:50navigate to the HelloFromFlexAndAIR application and once again, there's the icon displayed in the uninstall list.
04:57I'll double-click to uninstall, click the Uninstall link, and I'm done.
05:01So that's how the custom logos work. You can create them in any graphic application you like and you designate which
05:07logos you want use is using the application descriptor file.
05:11There is a user interface for selecting these files in both Dreamweaver and Flash CS3.
05:17If you're working in Flex Builder or using the software developers kit, you'll need to make the changes to the application descriptor file manually,
05:24but no matter whether you use the developer tools or make changes to the application descriptor file yourself,
05:29the underlying architecture for how you select the icons is always the same.
Collapse this transcript
7. Working with PDF Documents
Understanding AIR and Acrobat PDF fundamentals
00:00In this chapter of the video series, I'm going to describe how to display Acrobat PDF documents inside your AIR applications.
00:07Regardless of whether you build your applications using Flex, Flash or HTML, you're able to create an instance of an object called HTMLLoader.
00:16The purpose of the HTMLLoader control is to load HTML content but it can also load Acrobat PDF content as well.
00:23The HTMLoader control is used in its raw form in both HTML and Flash and can be called a nested control
00:30within another control called HTML, which makes it a little bit easier to use in Flex.
00:35One important thing to know about working with PDF in AIR,
00:39is that the Adobe integrated runtime doesn't actually include the Acrobat Reader.
00:43Instead, it depends on the version of the Acrobat Reader that's installed on the client's system already.
00:48This makes things a little bit different than working with Flash-based content or HTML,
00:53because the Adobe integrated runtime includes both the Flash Player and a web browser kernel you can always display
00:59that kind of content in a matter what's going on on the client system. But the Acrobat Reader is significantly larger and
01:05so the runtime depends on the Readers. It's already installed on the client system to do its thing.
01:10Specifically the user system must have Acrobat Reader or Professional version 8.1 or higher already installed in order
01:17to successfully display PDF-based content.
01:20You can programmatically determine whether the right version of the Reader is already installed, and I'll show you how to do that
01:26in the next few videos, and then once you decided it's OK to present content, you can use code either ActionScript or
01:32JavaScript, to create the instance of the HTMLLoader and present it on the screen.
01:39If the user has the right version of Acrobat Reader, here is what you can do.
01:43You can display the PDF document, in which case you'll get standard Acrobat Reader controls, such as paging controls,
01:49zooming controls and print buttons.
01:52You'll be in a programmatically control the behavior of the Acrobat document
01:55and you'll be able to use embedded Acrobat forms.
01:58The extent which the Acrobat forms will work successfully will depend on whether you load the Acrobat document from the local disk or from the Internet.
02:08In order to display in Acrobat document you'll use a different approach for each development platform.
02:13If you're working in Flex, you have two possible approaches. One is to create an instance of a class called HTMLLoader and
02:19then load up the content using that class and then present it.
02:22The HTMLLoader class is directly extended from the Sprite class and because it doesn't implement the interface known
02:29as IUI component, you can't directly add an instance of the HTMLLoader class to a Flex container such as the application.
02:36So to make things a little bit easier,
02:38there's a control and Flex called mx:HTML. This is the same control that I demonstrated in an earlier video when I showed
02:45how to load basic HTML content in an AIR application. Just like standard HTML, you set the HTML control's location property
02:52to the location of your PDF document and you'll successfully load the content.
02:57If you build your application in HTML, once again you can use the HTMLLoader class instantiated in JavaScript or
03:04you can use an HTML tag called object. You typically use the object tag, a declarative approach, if you're really sure that
03:11the local system has Acrobat Reader 8.1 or higher.
03:15The reasons to use the HTMLLoader class is because you can instantiate it in code and wrap that code inside a conditional
03:21section that first checks to see whether the right version of the Reader is installed.
03:26If you're working in Flash CS3 Professional, you once again use the HTMLLoader class.
03:31In the next three videos are surely how to display Acrobat PDF content using Flex, HTML and Flash.
03:38I'll first show you how to detect PDF capability, that is whether the appropriate version of the Acrobat Reader is installed locally,
03:45and then I'll show you how to actually display the content on the screen using any of these development environments.
03:51In the follow-up series to this essential training, I'll show you did how to exert programmatic control over Adobe
03:57Acrobat content, paging, zooming, printing and so on, using the development platform of your choice.
Collapse this transcript
Displaying PDF documents with Flex
00:00In this video I'm going to describe how to display an Acrobat PDF document in an AIR application built with Flex.
00:07I'll be creating this project from scratch using just an existing PDF document that's in the exercise files folder.
00:14If you follow along in the exercises, open Flex Builder and close any existing projects that you might have open.
00:20Then create a new Flex project. From the menu, select File,
00:24New, Flex Project.
00:27Name the project PDFReader.
00:30Accept the default location underneath your current workspace
00:34and set the application type to Desktop application (runs in Adobe AIR)
00:38and click Finish.
00:41Next, go to the exercise files directory and locate the PDF document.
00:46I'll navigate to the AIR Essential Training folder on my C drive
00:50and from there I'll go down to the assets folder and I'll locate the agenda.pdf file.
00:56I'll copy that to the clipboard,
00:58go back to Flex Builder,
01:01and then paste that document into the source root of the project.
01:07There are two classes that you can use to present Acrobat PDF documents within an AIR application in Flex.
01:13These classes are named HTMLLoader and HTML.
01:16The HTMLLoader class is extended from the sprite class, not from UI component, so you can't simply add it to the Stage of a Flex application.
01:25Instead, to use HTMLLoader, you have to first wrap it inside your own class that extends UI component and then and only
01:32then can you add it to the Stage.
01:34For convenience, the Flex class library includes a component called HTML.
01:38The HTML component I'm going to use is the same one that I demonstrated in a previous video when I showed you how to
01:44display HTML content within a Flex application.
01:47You can declare the HTML component in pure ActionScript like this.
01:51I'll put in a MX:HTML component, I'll give it an ID of myPDF and then I'll set its location property to the location of
02:00the PDF document I want to display.
02:03If you want to display PDF document that's downloaded from a website, put the absolute URL of the location of the document right here.
02:11If on the other hand, the PDF document is local, that is stored in the same local directory as the application itself,
02:17you can use a special URL that looks like this- app:/
02:21This is a pointer to the application's installation directory and the user's local system.
02:28And then put in the name of the file that you want to display.
02:31I'll put in agenda.pd.
02:33The HTML component is just like any other visual control in Flex. You can add width and height properties.
02:40I'll set those to 100% each.
02:44And you can control its position in the same way you do any other control.
02:48For the moment, though, that's all I need.
02:50Above the HTML control, I'm also going add a label control. I'll set its text property to PDFReader,
02:57and I'll send its font size to 18 pixels. Before I run the application, I'm going to set the application's layout
03:05property to vertical so that the label and the HTML component will stack on top of each other.
03:10And in the resulting application you'll see the label at the top displaying the text PDFReader and you'll see the HTML
03:16component below displaying the PDF content.
03:19Notice that as I resize the browser that the embedded Reader is resizing automatically and the PDF document is resizing as well.
03:27Also notice that at the top of the PDF interface, you get the standard Acrobat Reader toolbar including the ability to print,
03:34save, e-mail, page forward and back, zoom, pan and so on.
03:40So everything you're able to do in Reader, you're able to do here.
03:44So that's one approach. You can simply declare the HTML component. On the other hand, there are times when you have to
03:50first check to see whether the user has the ability to display the PDF document. And in next video, I'll show you how to
03:56programmatically detect whether the user has the right version of the Acrobat Reader installed,
04:00and then how to instantiate the HTML component programmatically and place it on the Stage.
Collapse this transcript
Detecting PDF capability with Flex
00:00In this video, I'm going to describe how to detect whether a user system has Acrobat PDF capability. That is, whether
00:07it has the right version of the Acrobat Reader before you try to present Acrobat content in the AIR application.
00:13To accomplish this, you use a property of the HTML and HTMLLoader components called PDF capability.
00:20The value of this property can be compared to constants which are members of another class called HTML PDF capability.
00:27To demonstrate this I'll work in the same application as before, PDFReade.MXML.
00:32I'll start by commenting out the existing HTML component.
00:36I'll select the MXML tag that's implementing the HTML component then from the menu I'll select Source, Toggle Block Comment.
00:45Next I'll add a script section.
00:48Within the script section I'll create a new private function called initApp,
00:53returning void and then I'll go up to the start tag of the windowed application components and add a creationComplete event handler,
01:02in which I'll call the new function initApp.
01:08I'm double-clicking on the tab to expand the editor to full screen. As the application starts up, I want to detect whether
01:15the user is going to be able to display the PDF content correctly.
01:19I'll add the if clause and use this evaluation:
01:23if HTML...
01:25now before I continue typing, I'm going to press Control + space and select the HTML class from the list of available classes.
01:31This causes Flex Builder to add in an import statement for that class.
01:35Then I'll continue with the code, .pdfCapability.
01:40This is a static property so you can call the property directly from the class rather than from an instance of the class.
01:46Then I'll put in the equivalence operator.
01:49And I'll compare that values to HTMLPDFCapability.Status_OK.
01:56These are the five possible values.
01:58Error_cannot_load_reader means that the Reader couldn't be loaded for whatever reason,
02:02and the other values indicate that the Reader either wasn't installed at all, or that it is installed, but it's too old.
02:09I'm looking for the value of Status_OK, so I'll complete the conditional clause and then put in a pair of braces.
02:16Within the braces I'll create an instance of the HTML component.
02:20I usually like to declare this kind of component outside of any functions, so I'll place the cursor outside the initApp function,
02:27below the import statement,
02:28and add a declaration of private var myPDF, type as an instance of the HTML object.
02:36And then within the conditional block I'll instantiate the object using the HTML classes, no arguments constructor method.
02:44Next I'll set some of its properties.
02:47As with the XML version, you indicate what you want to load with the location property.
02:52And just as before you can use at app:/ to indicate that you're loading a document locally. So I'll copy and paste
03:01the existing string app:/agenda.pdf and put it in the new declaration in the ActionScript section.
03:08Next I'll set the component's width and height.
03:11When you set percentage width and height dimensions using ActionScript, you have to use properties called percentWidth
03:17and percentHeight, which are set to numeric values. So I'll do it that way, I'll say myPDF.percentHeight equals 100,
03:26and myPDF.percentWidth equals 100.
03:30I've constructed the object, I set its location, and I've set its dimensions. Now it's time to add it to the Stage.
03:36I'll use the syntax this.addChild, which can be used to add any visual component to the Stage and I'll pass in the object myPDF.
03:45Notice that the application is executing this function upon application startup, so as the application starts up, it first
03:51checks to see whether the user will be able to correctly display the PDF document and then it constructs the object and displays it.
03:58After the if statement I'll add an else condition, in which we won't see executed on the system because I do have Adobe
03:58Acrobat Reader installed. And I'll use the alert class.
04:07I'll type in alert and press Control + space, and select the alert class
04:11and then use its show method to show an error indicating that the user won't people to display the PDF document.
04:18I'll use a message of "Can't display PDF content."
04:23And in the alert.Show method's second argument I'll just pass in a simple string "error" to show up in the title of the dialog box.
04:31That's it. Now for testing.
04:33I'll save the file
04:35and then run it from the toolbar by clicking the Run button.
04:40And as the application starts up, once again it first checks to make sure that the Reader can be loaded correctly
04:45and then it displays the content.
04:47So these are the two approaches for displaying Acrobat content in Flex.
04:51You can either use a simple MXML declaration or you can create the object programmatically and first check to make sure that the user has PDF capability.
05:00Also remembered the other class, the HTMLLoader, which I won't demonstrate here but can also be used when wrapped inside
05:07your own classes that implement the UI component interface.
Collapse this transcript
Displaying PDF documents with HTML
00:00In this video I'm going to describe how to display an Acrobat PDF document in an AIR application built in HTML.
00:07You can use an ActionScript class called HTMLLoader and you can also use an HTML object tag. I'm going to use the object
00:13tag in this approach because it's a little bit simpler.
00:16I'll be creating the application from scratch and I'll use the same PDF document I did in the previous video showing how to do this with Flex.
00:23In Dreamweaver select Site, New Site.
00:28Set the name of the site to PDFReader,
00:31and then click to browse.
00:33Navigate to the exercise files folder, where ever you installed it on your system.
00:37I'll go to C:/AIR Essential Training.
00:41From there, go to the HTML folder.
00:43Then once you're in that folder create a new folder and name it PDFReader.
00:49Select that folder and then click Select.
00:52Then from the Site Definition dialog box, click OK.
00:56Next create a brand-new HTML document.
00:59Under the Create New heading on the Dreamweaver welcome screen, click HTML,
01:04and save that document as PDFReader.HTML.
01:10Then create your application descriptor file.
01:13Go to the menu and select Site,
01:15AIR Application Settings,
01:17click the Browse button next to Initial Content.
01:20Select your HTML file,
01:23and click Save.
01:25So that's your beginning HTML file.
01:27Next I'm going to go get the PDF document that I want to include in this project.
01:31I'll go to my exercise files folder.
01:34If you're following along just go to which ever folder you installed the exercise files in.
01:38Go to the Assets folder,
01:41select the file agenda.pdf, and copy it to the clipboard.
01:46Go back up a folder to the AIR Essential Training and down to HTML,
01:51from there to PDF Reader,
01:53and paste the document into place.
01:56Close Windows Explorer or Finder on the Mac
01:59and return to Dreamweaver.
02:02Over in the Files panel, you may need to click the Refresh button to see that the PDF document is now in your site.
02:08Here is the simplest possible code to display a PDF document inside an application built in HTML. Place the cursor
02:16between the body tags and put in an object tag. Add to the object tag a data property
02:23and set it to the PDF file. Just as with the application built with Flex, if you want to load a document from the local
02:29disk where the document is stored in the same folder in which the application lives, use the protocol app:/
02:37and then put in the name of the document.
02:41Also add width and height properties of 100% each. This will cause the PDF document to expand to fill the application.
02:48Then close the object tag by putting in a slash and a greater than symbol.
02:53Go to the title element within the head section of the document and change it to PDF Reader.
02:59Save your changes.
03:01Now you're ready to test.
03:03In Dreamweaver, go to the menu and select Site,
03:06AIR Application Settings,
03:08and click the Preview button.
03:11The application should load up and should display the PDF document.
03:15If you have any problems with this, check that your system has Acrobat Reader 8.1 or higher installed.
03:21Now, just as with Flex, it's possible to programmatically detect whether the user has the right version of Acrobat Reader installed
03:27and then to instantiate this object programmatically.
03:31Before you can do this, you need to go get the file AIR Aliases.JS from the software developers kit and make it a part of this application.
03:39Here's how I'll do that.
03:41First of all, I'll navigate to the folder where I installed the software developers kit.
03:45On my system, it's under C:\AIRSDK. You'll go to whichever folder you installed it in.
03:52From there go to the frameworks folder where there are three JavaScript files.
03:56The one we need in our application is AIR Aliases.JS.
04:00I'm going to select and copy that file to the clipboard.
04:04Then I'll navigate back to my exercise files folder, AIR Essential Training.
04:09From there to the HTML folder,
04:12and from there into my new PDFReader folder,
04:15and I'll paste the file into the folder.
04:18Now close Windows Explorer or Finder, if you're on the Mac
04:22and return to Dreamweaver.
04:23In Dreamweaver you may need to click the Refresh button to cause the new file to show up.
04:29Now I'm going to link to AIR Aliases.JS file into the application.
04:33Place the cursor inside the head section of the HTML document and put in a script element.
04:40Add in an SRC attribute.
04:42I'll then press Enter or Return to browse,
04:46and select AIR Aliases.JS by clicking,
04:49and then clicking OK.
04:51Also be sure to add the type attribute and set it to a value of textJavaScript.
04:57Close a tag with the greater than symbol,
04:59and then be sure to put in the end tag for the script.
05:03That results in linking in the JavaScript library into the application.
05:07Now in order to detect whether you have PDF capability,
05:11put in another script tag. Once again set the type to text/JavaScript and a couple lines further down putting an end tag.
05:22We're going to put in some JavaScript code that won't be inside a function so it will execute as the application starts up.
05:28Place the cursor inside the script tags and typing if (.
05:33In HTML -based applications in AIR, all the components that we refer to directly in ActionScript code are exposed as
05:40aliases that are members of the AIR object. So to refer to the HTMLLoader class, which is going to tells whether the user has PDF capability,
05:49thee expression looks like this: air.HTMLLoader.
05:54And then type in another dot and you'll see that the HTMLLoader class has a bunch of properties that Dreamweaver knows about
06:01and I'm going to select PDFCapability.
06:04If you work through the previous video with Flex, this will look very familiar. The only real difference is that the
06:09HTMLLoader class is prefixed with the AIR object, which is an alias. Now putting the double equals.
06:17And I'll move down a line so it's easier to see on the screen.
06:20And I'm going to compare that value to air.HTMLPDFCapability.Status_OK.
06:30The version of Dreamweaver I'm working in doesn't know about that class, but that's OK. I know that it's there and
06:36it's in the AIR aliases file. So this all worked fine.
06:39After the if clause add a pair of braces and then within the if clause, we're going to use a standard JavaScript command document,
06:48document.write to add the object to the application.
06:51Put in the code document.write('');.
07:02Now go down to the line that has the object declaration at the bottom of the application,
07:08select that line of code,
07:10cut it to the clipboard.
07:12I'm going to right-click or Control-click on the Mac and select Cut.
07:17Then place the cursor inside the single quote's, inside the document.write command,
07:22and paste the code into place.
07:25So now we're dynamically writing content to the HTML presentation as the application starts up.
07:32After the if clause, add an else clause.
07:34The syntax is else and then a beginning and ending brace, and then type in the command window.alert
07:42and type in an error message of "PDF content can't be loaded." Notice how I'm nesting the various quotes. I used single quotes
07:52in the document.write command because the expression I wanted to write has double quotes and in the window.alert command,
07:58I am wrapping double quotes around the string that has a single quote. In JavaScript you can change double quotes and single quotes as needed
08:04as long as everything's nested properly.
08:07This couple execute automatically upon application startup, because that's the nature of how JavaScript executes code
08:14that's outside of any functions.
08:16To test, I'll go to the menu and select Site,
08:20AIR Application Settings,
08:22and once again click Preview.
08:24The application loads up and displays the Acrobat PDF content.
08:29So that's how you display PDF content in an HTML-based application.
08:33The simplest approach is to use the object tag with the data property and you can either declare it directly within
08:39your HTML body content or you can dynamically write it to the screen using the document.write command.
08:45As with the other development platforms, the HTMLLoader object has the PDF capability property and the HTML PDFCapability class has
08:53constants that you can use to compare it to, to find out whether the user has the right version of the Acrobat Reader to
08:58do what you want to do: displaying the Acrobat PDF content.
Collapse this transcript
Displaying PDF documents with Flash
00:00In this video, and I'm going to show how to display an Acrobat PDF file in an AIR application built in Flash CS3.
00:07As in the previous two videos, where I showed how to accomplish this task using either Flex or HTML, I'll show you how to both
00:15display the PDF document and also how to check to see whether the user has the right version of the Acrobat Reader installed.
00:22I'll be creating this document from scratch and placing it under the Flash folder under the exercise files area.
00:29To get started, navigate to the exercise files folder. I've placed it in C:\AIR Essential Training or
00:35if you're working on a Mac, locate the folder where you installed it.
00:39And navigate down to the Assets folder.
00:42Locate and copy the agenda.pdf document to the clipboard.
00:47Then return back to the exercise files folder,
00:50go down to the Flash folder and paste it,
00:55and then returned to Flash CS3.
00:59Next create a brand new Flash file for Adobe AIR.
01:02You can do this from the welcome screen, just click the link.
01:06If you see this informational dialog, click OK to clear it
01:10and then save the file.
01:12I'll select File, Save As.
01:15Make sure you're in your Flash folder underneath the exercise files area and name the new document to PDFReader.FLA.
01:25Next, set up your application descriptor settings.
01:29Go to the menu and select Commands,
01:32AIR Application and Installer Settings,
01:35and click OK.
01:37Now we're going to be using classes from the AIR libraries.
01:41There's a file called playerglobal.SWF that's a part of the Flash updater installation for AIR.
01:48Before you get started doing any programming, you should check to make sure that your documents class path includes the folder that contains that file.
01:56To check this and set it if necessary, go to the menu and select File,
02:01Publish Settings.
02:03Click on the Flash tab,
02:06and then right next to the ActionScript version selector, click the Settings button.
02:11In the Classpath section, this value may already be set up, but if you don't see an item pointing to a classes directory,
02:18under an ActionScript 3.0 for AIR 1. 0 folder,
02:22click the Browse button for the classpath,
02:25and then navigate first to your Flash installation directory.
02:29On Windows, the default location is C:\Program Files, Adobe, Adobe Flash CS3.
02:39On the Mac it'll be under the Applications folder,
02:42under Adobe and then again, Adobe Flash CS3.
02:46From the Installation folder, navigate down to the EN folder.
02:50From there to Configuration,
02:52and to ActionScript 3.0 AIR 1. 0,
02:57and from there to the Classes folder. Click to select the Classes folder.
03:02Click OK,
03:03and click OK again.
03:06This brings you back to the Publish Settings.
03:08Click OK one more time,
03:10and now you're ready to do a little bit of ActionScript programming using the AIR Libraries.
03:15Go to the default layer, double-click on it and change the name of the layer to Actions.
03:22Then click into the first frame of that layer
03:25and from the menu select Window, Actions,
03:29or press the F9 keyboard shortcut.
03:32In order to display an Acrobat PDF document in Flash, you use a class called HTMLLoader, which is a member of a package called Flash.html.
03:42This class is part of the AIR API libraries and the reason you had to go check the classpath was to make sure that
03:49the SWIK file or component library for AIR is a part of this document's classpath.
03:55You also have to explicitly import the class that displays the Acrobat PDF content.
04:00To do this, type in an import statement,
04:03and then put in Flash.HTML.HTMLLoader.
04:11Next create a new instance of the HTMLLoader class. First declare a variable,
04:17name it PDF,
04:18and datatype it as an instance of the HTMLLoader class,
04:22and then instantiate the class using the syntax = new HTMLLoader.
04:30You're calling the HTMLLoader class's no argument constructor method to create an instance of the class.
04:36Next you need to create an instance of another class called URLRequest.
04:41The URLRequest class is designed to wrap a URL and it verifies that the URL is well formed.
04:48To create the URLRequest class declare another variable. Name it request and datatype it as URLRequest.
04:57Construct it with this code: new URLRequest
05:04and then inside the parentheses, type in a string that indicates where the PDF document is.
05:11As I described in the previous videos about accomplishing this task with Flex and HTML, you can refer to a PDF document
05:18that's in the same local folder as the application itself with the prefix app:/.
05:24This is an AIR-based protocol details the application to look in the local disk.
05:30Next, put in the name of the file agenda.pdf.
05:35To load the document, use the load method of the HTMLLoader class.
05:41I'll type in the syntax, PDF.load, and then pass in the request object.
05:48Next set the HTMLLoader object's dimensions.
05:52I'd like to set the object's dimensions to the same size as the Stage itself.
05:57So I'll click the minimize icon on the Actions panel.
06:01Then click on the Stage and check the dimensions.
06:04Notice that the Stage dimensions are 550 pixels wide by 400 high.
06:09So now I'll go back to the Actions panel,
06:12and I'll set the HTMLLoader objects dimensions as follows.
06:16I'll set the width to 550 and the height to 400. Finally, I'll add the document to the Stage. I'll use the addChild method
06:31and pass in PDF.
06:33And that's all the code you need to display the PDF document in the AIR application.
06:39I'll close the Actions panel and save the document,
06:43and then run the application. You can run the application from the Control menu by selecting Test Movie.
06:51As the application opens up, it loads the PDF document and displays it.
06:56As with the other examples in this chapter, you'll see that you have complete skinning of the PDF document.
07:02You have controls to print, save, e-mail, page forward and back and essentially navigate the Acrobat document just as you would using the Acrobat Reader.
07:12Lets go back to the code and I'll show you how to accomplish the task of checking to see whether the user has the right version of the Acrobat Reader.
07:21Go to Window, Actions again.
07:24And place the cursor after the import statement and before the variable declaration for the HTMLLoader.
07:31Change the import statement as follows. We're going to be using another class from the Flash.HTML package.
07:38So take out the HTMLLoader class and instead put in an *, meaning that we want to be able to use any class from that package.
07:46Then go down a couple lines to a blank line and type in an if statement.
07:52Check the following.
07:53if (HTMLLoader.PDFCapability == HTMLPDFCapability.Status_OK)
08:09See you see that the code you use here is almost exactly the same as the version in HTML. It's slightly different than
08:16the version in Flex, because there I used an HTML object instead of an HTMLLoader.
08:21Then I'll wrap all this code inside braces and this will ensure that the document only shows up if the user has the right version of Acrobat on their system.
08:32I'll close the Actions panel,
08:34returned to the document and then test it again,
08:37and you'll see that the PDF document once again does display correctly.
08:42Finally, I'd like to show you one other thing that may have happened in the background. I'm going to go back to the Publish Settings dialog.
08:48I'll go to the menu and select File, Publish Settings,
08:52go back to the ActionScript settings by clicking the Settings button next to the ActionScript version selector,
08:58and in the classpath, notice the location of my classes folder under ActionScript 3.0 AIR 1.0 has been modified to show a variable of app config.
09:10This value made shown up for you when you first created the project and if so, it works out of the box,
09:15but there are times when it isn't set up automatically right away and later on if you have set up manually, Flash will go in and
09:29change that value, the prefix before the ActionScript 3.0 AIR 1.0 folder, to the appropriate variable.
09:30That's an expected behavior.
09:32So now you know how to display a PDF document using either Flex, HTML or Flash. The code styles are a little bit different
09:41for each platform, but the end result is the same.
Collapse this transcript
8. Creating Applications with Transparency
Using application properties for transparency
00:00In this chapter of the video series I'm going to describe how to create transparent window applications in AIR.
00:06A transparent window application, sometimes known as a gadget or a widget application,
00:11displays graphic elements that you create and supply in the application but doesn't wrap the application inside operating system style windows.
00:19Instead the background of the application is completely transparent, allowing the rest of the windows of the operating system to show through.
00:26This behavior is enabled through the AIR nativeWindow class.
00:30All windows, including the initial window of the application,
00:33are constructed as instances of this class.
00:36The nativeWindow class has a couple properties that you can set to support transparency.
00:41There are two steps to turning on transparency for any particular window.
00:45The first step is to indicate that you would don't want use the operating systemChrome.
00:50And then the second step is to turn transparency on.
00:53For the application's initial window, these options are set in the document descriptor file.
00:58For additional windows that you might pop up during the applications running, you can set these values programmatically
01:04in ActionScript or JavaScript.
01:07For the initial window, in order to set the values in the document descriptor file, both Flash and Dreamweaver provide
01:13a user interface where you can easily set up the transparency options using the dialog box for the application settings.
01:20If you're building AIR application using Flex Builder or the SDK, you need to set these properties manually and I'll show
01:26you how to do that in the Flex video.
01:29Here are the requirements for the application itself.
01:31For both Flash and HTML, once you turn off the operating system chrome and set the windows transparent property to true,
01:39the background of the application becomes transparent.
01:42For HTML, if you set the HTML pages body element's background image or color to some value, it'll show up.
01:48For Flash, the application background always becomes transparent and any color that you might set in Flash is ignored.
01:55For Flex, there's an additional trick. Instead of using the windowed application element as the root of your Flex application,
02:00you instead use MX application.
02:05The windowed application element always shows a certain amount of application chrome, that is minimize/maximize buttons and so on,
02:12where as the MX application element is capable becoming completely transparent.
02:17In addition, you'll set certain cascading style sheet properties
02:21to ensure that there's no background color or background image that shows up.
02:25And then any graphical elements that you create will become visible, but the rest of the window will be transparent,
02:31allowing other windows in the operating system to show through.
02:34Once you've created a new window this transparent, you've taken away the chrome and the controls that typically allow
02:41the user to move windows around the workspace.
02:44And so if you want the user to be able to move the application around, you have to program it.
02:49This is done by candling an event called mouseDown.
02:52The mouseDown event is the same regardless of what you're working in Flex, Flash or HTML.
02:57The syntax for handling the event will be different,
03:00but in reaction to the mouseDown event you call a method called startMove, which is a method of the current nativeWindow object.
03:08That nativeWindow object is accessed through the current Stage. Again the syntax will be slightly different for each platform,
03:15but the basic idea is that you call this line of code
03:19and you're telling the application that once the move operation has been initiated, every time the user moves the mouse around,
03:25without having lifted up the mouse button, the application should move in reaction.
03:30Once the user releases the mouse button, the move action is terminated automatically. You don't have to execute any code
03:37to stop that from happening.
03:38And then each time the user presses down on the mouse or the mouse is over the appropriate object, you'll be starting the move operation again.
03:46In each of the next three videos I'll show you how to implement this in Flex, HTML and then Flash.
03:52And again you'll see that the coding is all pretty much the same but the style is a little bit different and some of the
03:59application requirements, especially in Flex are a little bit different as well. The end result though will be the same.
04:05An application that appears as a widget or a gadget on the desktop without the standard window chrome that you see in
04:11conventional Windows or Mac OS X applications.
Collapse this transcript
Creating transparent applications in Flex
00:00In this video I'm going to describe how to convert a Flex application written for AIR into an application that has an invisible background window.
00:08I'll be using a finished application called the StockQuoter application.
00:13This application is available in the exercise files, in a project archive file called stockquoter.ZIP.
00:20If you're following along in the exercises, go to Flex Builder 3.
00:24Close any project you might have open,
00:26and then from the menu, select File, Import, Flex Project.
00:32In the Import Flex Project dialog box,
00:35click the first Browse button next to Archive File
00:38and then navigate to the Projects folder under the exercise files area,
00:43select the stockquoter.ZIP file and click Open.
00:47In the Import Flex Project dialog, click Finish to import the project.
00:52In the Flex Navigator view, open the project.
00:55Open the source root,
00:57and then double-click to open stockquoter.MXML.
01:01This application uses the Yahoo Web service to get current stock information.
01:07Run the application to see its current behavior.
01:10As the application opens the cursor ends up in a text input control.
01:15You can type any stock symbol you want and press Enter or click the Get Quote button,
01:19and a Web service call goes out Yahoo to get the current price of that stock and when data comes back from Yahoo,
01:25it's displayed in a separate component.
01:28Down at the bottom of the screen in the status bar, if you type in the value that's not a valid stock item,
01:34you'll see a message, "Symbol blah blah...", or whatever symbol you typed in, "not found."
01:39I'm not going to do full code review of this application. It is a fairly conventional Flex application that uses an HTTP service component,
01:47and also uses of a view state definition and a transition to manage the presentation of the data results. The one thing that
01:54makes it an AIR application specifically is the use of the windowed application component as the application root.
02:00Also there's an existing application descriptor file named stockquoter-app.XML.
02:06To convert this application to a transparent window, there are a few steps to follow.
02:11First open the application descriptor file stockquoter-app.XML.
02:16Then double-click the tab at the top of the editor to display full-screen
02:20and scroll down to the initial window settings.
02:23There are three properties that you have to set to create an application with transparency for Flex.
02:29First, the systemChrome.
02:30The default for the systemChrome element is standard, meaning that the application initial window displays the buttons
02:38and gadgets for the current operating system, Windows or the Mac.
02:41In order to remove the operating systemChrome,
02:44remove the comments from around the system chrome element and set it to a value of None.
02:49Next set transparency.
02:51Go down to the transparent element, remove the comments from around the element and then within the transparent tags, type in true.
03:00The transparent value can only be set to true if systemChrome is set to None.
03:05Finally you have to explicitly make the initial window visible on application startup.
03:10Go down to the visible element remove the comments and once again, click between the tags and type in the value of true.
03:20Save your changes.
03:21Go back to the application source code and click the Run button again to run the application.
03:27And let's take a look of what's happened so far.
03:29Notice that the look of the window is somewhat different. Instead of the classic Windows Vista look and feel,
03:35which was displaying before, I now have a much plainer look.
03:38I don't have any transparency in the title bar, which Windows Vista was providing before,
03:43and the buttons over on the right are much simpler than before.
03:47But I still don't have complete transparency.
03:50Close the application and now we're going to make changes to the application itself to implement the transparent window.
03:57In order to implement transparency in a Flex application, you need to switch from the windowed application
04:02as the application root to the MX application root.
04:06This is the traditional application root that's used in Flex Web applications.
04:11Go to the start tag and change from MX windowed application to application,
04:16and then scroll down to the bottom of the application and make the same change in the end tag.
04:21Save your changes.
04:22Now, you'll notice that you end up with a couple problem spots in the application code.
04:27There are references to a property of the application element named status.
04:32This status property referred to the status bar within the windowed application root element, but when we switched to
04:38the application element the status property didn't exist anymore.
04:42So in order to display the error message if a symbol isn't found,
04:46go to about line 57, the line that starts with this.status=
04:52and remove this.status=
04:56and replace it with alert.show.
04:59And then wrap the error message in parentheses.
05:02Then go back to the alert class that you typed in, and to make sure to Flex builder has added an import statement for
05:08the alert class, press Control + space and then Enter or Return.
05:14Scroll up to the top of the code and you should see that Flex Builder has added in the import statement for MX.controls.alert.
05:22There is one other reference to this.status. It's right here.
05:26This is no longer needed, so I'll just comment it out,
05:29and I'll save the application
05:31and run it again.
05:33This time the application shows up without any window chrome around the edges, but I still see all the background of the application.
05:40So I'll close the application on Windows. I'll pressed Alt + F4,
05:44and if you're working on a Mac, press Command + Q.
05:47Next you'll remove the background from the application.
05:50Notice in this application there's a reference to a file called styles.CSS at line 19 or so.
05:56I'll go back to the Flex Navigator view
05:59and open the file styles.CSS. Place the cursor after the comment and type in a new selector for the application component.
06:07Within the application component, set two properties. First, background colors, which is set to a blank string
06:17and then background image, which you also set to a blank string.
06:20Save your changes,
06:22go back to the application and run it again.
06:25And now the application shows up without any background.
06:27I'll click in and type a stock quote,
06:30press Enter,
06:31and there's the symbol showing up.
06:33Now in the next video, and I'll show you how to add code to allow the user to move the application around
06:39by clicking some more on the application. You'll handle the mouseDown event and execute a little bit of code to start the mouse move operations.
Collapse this transcript
Creating application movement in Flex
00:00In this video I'm going to describe how to implement user movement in an application that has transparent windows.
00:07By user movement, I mean the ability for the user to click somewhere in the application and move the application around the screen.
00:14This capability, while it's there automatically when you use the windowed application component, is gone when you take away the
00:20operating systemChrome and make the rest of the application transparent.
00:24There are two steps to the process.
00:26First, for each component on which you want the user to be able to click to move the application, you add an event listener
00:32for the mouseDown event.
00:34And then when that event occurs, call a method of the nativeWindow object called startMove.
00:40Whenever the user clicks on any visual component that's listening for the event,
00:44you'll then start the move operation.
00:47As the user moves the mouse around the screen, the position of the application will track with the mouse movement.
00:52When the user releases the mouse button, the move operation will be terminated and you don't have to add
00:57any additional code to make that happen.
01:00To start, go down to the stockquoter application
01:04and place the cursor after any of the variable declarations.
01:07Then create a new private function and name it mouseDownHandler.
01:14Have the function receive an event object, typed as a MouseEvent class and return void.
01:22And then within the function, use this code to start a move operation.
01:27this.Stage.nativeWindow.startMove. That's it, that's all you have to do.
01:34Now to trigger this function,
01:36I'll go to the two components that the user is able to see.
01:40The HBox component that displays the entry inputs and also the container that displays the results.
01:46For each of the containers I'll add a mouseDown event listener
01:50and call my function mouseDown handler
01:52and pass the event object.
01:54I'll go up to the view state declaration at the top of the application and add the same code to the quote view component instance.
02:01Once again, I'll put in the mouseDown event listener in MXML,
02:06and I'll call my custom function and pass the event object.
02:10Now to test it.
02:11I'll run the application,
02:14and now I can click on the application and move it anywhere around on the screen. I'll type in a stock quote
02:21and click the button or press Enter or Return.
02:23And now that component also has the mouseDown handler and so I can click on that visual component and move it around also.
02:30Notice if I click anywhere else in the rectangular region of the application, that the mouse click event goes through to
02:36the underlying window, in this case Flex Builder.
02:39So you only handling the mouseDown event on the visible objects, not on the entire application, and as the user clicks on
02:46any of those objects you're able to move the application around as needed.
02:51It's also possible to add any other visual components you need to create the full user interface that you think your application requires.
02:59Now in the next videos, I'll show you how to accomplish the same steps using applications for AIR that are built in either HTML or Flash.
Collapse this transcript
Creating transparent applications in HTML
00:00In this video I'm going to describe how to create in AIR application in HTML that uses a transparent window.
00:06I'll also show you how to allow the user to drag the window across the screen,
00:10after you've removed all the window chrome, the standard gadgets and widgets that usually allows the user such actions.
00:17I'm going to demonstrate this capability using an existing applications that you'll find in the exercise files folder.
00:23To get started, navigate to the exercise files folder. From there go down to the Projects folder
00:29and look for a ZIP file called stockquoter.HTML
00:32Extract the contents of that file to the HTML folder under the exercise files directory.
00:38In Windows Vista I can do this with right-clicking on the ZIP file,
00:42selecting Extract All,
00:46and then navigating to the appropriate location
00:49I'll select Computer,
00:50C drive,
00:53AIR Essential Training,
00:55HTML,
00:56and click OK.
00:58If you're using WinZIP on Windows or you're using Mac OS X,
01:02extract the files using whatever features you have available
01:04and place the content of the file in the HTML folder underneath the exercise files area.
01:10I'll click Extract,
01:12and in Windows Vista that results in opening the HTML folder.
01:17I'll drill down into the StockQuoter folder that was created,
01:20and you'll see that there are three files there.
01:23The application itself stockquoter.HTML,
01:26the application descriptor file, application.XML,
01:29and the copy of the AIR Aliases file that comes from the software developers kit.
01:34Now I'll close whatever operating system windows I still have open and return to Dreamweaver.
01:40Next, create a site definition that points to this folder.
01:43From the Dreamweaver menu and select Site, New Site.
01:48Name the new site stockquoter,
01:52and change the local root folder setting to the new stockquoter folder under the HTML section of the exercise files.
01:59From the exercise files folder, I'll drill down into HTML
02:03and select the new StockQuoter folder
02:05and then click Select.
02:07And then I'll click OK to create the site.
02:11Let's take a look at what the application does in its initial state.
02:15I'll go to the Site menu,
02:16to AIR Application Settings
02:19and click the Preview button.
02:21The application exercises the same sort of functionality as the Flex application I demo'd in the last video.
02:28The user can click into a text input control,
02:31type in a stock quote symbol, click the button,
02:34and get a response.
02:35This version of the application uses the same Yahoo Web service that it used in the previous Flex application.
02:42It retrieves the content using a JavaScript component called XML HTTP request.
02:48It navigates to the site, retrieves the string and then in the function that's defined as the on ready state change property
02:55of this object, the date is parsed and presented to the user.
03:00Now my goal is to give the application a transparent background and then allow the user to easily drag it around the screen.
03:07The first part is quite simple in Dreamweaver because the Dreamweaver user interface for controlling the application
03:13descriptor properties let's you make all the required changes with one setting.
03:18From the menu, go to the Site
03:20AIR Application Settings,
03:23and then take a look right around the middle of the dialog box for an item labeled Window Style.
03:28There are three possible settings.
03:30The default is systemChrome, meaning make the application look like the native operating system.
03:35Select Custom Chrome Transparent,
03:38and then click Save.
03:40And then go back to the Files panel in Dreamweaver and double-click to open the file, application.XML.
03:48That single change that I made in the Application Settings dialog changed three properties of the application descriptor file.
03:55systemChrome, transparent and visible.
03:58And you'll notice if you worked through the previous video about the Flex application that the property settings are the same.
04:05systemChrome is set to none,
04:06transparent and visible are both set to true.
04:09Now to show the results in the application, I'll close the application.XML file.
04:15I pressed Control + W to do that. On the Mac you press Command + W.
04:19And then I'll go back to Site,
04:21AIR Application Settings.
04:23Preview again,
04:25and now you'll see that the application shows up but without any background window chrome and without the application background itself.
04:32I can click into the application, type in a symbol and click the button,
04:36and I get back the response.
04:38So the functionality of the application hasn't changed at all.
04:42I don't have the ability to drag the application around the screen.
04:45And I also don't have any visible widgets that allow me to close the application.
04:50So I'll press Alt + F4 to close it on Windows, or Command + Q if you're on a Mac,
04:55and then I'll close the Installer Settings dialog and go back to the code.
04:59In order to provide dragability, that is to allow the user to move the application around the screen, to go to the Script section
05:06of the application. It is the Script section that contains all of the existing code.
05:11Place the cursor after the variable declaration of RSS root, and create a new function and name it startMove.
05:20The function signature doesn't need any arguments
05:24and within the braces, you'll use a single statement to start a move operation.
05:29As with the Flex version of this application, you'll be dealing with the nativeWindow object that makes up the
05:36initial window of the application.
05:38In JavaScript and HTML,
05:40The syntax for referring to this object is very simple. It is simply nativeWindow and then as I did in Flex, [00:05:4.90] I'll call a method called startMove.
05:51When this method is called, it means that the application's position on the screen should track with any mouse movement
05:57until the user releases the mouse button.
05:59And when the user releases the mouse button, the move operation is terminated without you having to execute any additional code.
06:06Now to call this function, I'll go down toward the bottom of the code to the two visible div tag sets.
06:13There's two divs, one as the data entry form, the other is the display of the results.
06:18I'll go to each of them and add in onmouseDown event handler,
06:24and within the event handler I'll call my startMove method.
06:29I'll put in that code for both the entry form div and also put it in for the quote display div tag.
06:37I'll save the changes,
06:39go back to the menu and select Site,
06:42AIR Application Settings,
06:44click Preview,
06:46the application appears on the screen,
06:48and now I can click on either of the visual div tags and move the application around the desktop. If I click
06:54somewhere other than on the visual components, the mouse click event is handled by the background window and not by the application.
07:01So now to close the application, I'll bring it back and press Alt + F4 or Command + Q on a Mac.
07:08It's also good idea to give the user a visual way of closing an application.
07:12The code to close an application is incredibly simple.
07:16It is the same as with the window that's hosted inside a browser. It's simply called window.close.
07:21I'll create a function called up closeApp,
07:26put in a pair of braces, and then call the code window.close. Then to give the user a visual widget that they can click
07:36to close the application,
07:37I'll go to the entry form div tag
07:40and add another button.
07:43In the onClick event handler I'll call my new method closeApp,
07:49and then set the label of the button between the tags as simply close.
07:54And then put in the end tag for the button component.
07:57I'll also check out the application in Design view.
08:00I'll click the Design button because I want to make sure that the buttons aren't wrapping.
08:04Notice that they're wrapping because the div tag that hosts them is not wide enough.
08:09So in Dreamweaver, I'll click on the div tag and then drag it out to right so that there's enough space to display
08:15both of the buttons.
08:17I'll save,
08:18go to the menu and select Site, AIR Application Settings,
08:23then Preview.
08:25Notice I'm still able to move the application around the screen,
08:29I'm able to click in and type in a stock symbol and get a quote.
08:34And I'm able to close the application.
08:37So you can control the window programmatically.
08:40To close the entire application call window.close. To allow the user to drag the application around the screen,
08:47call the start move function of the nativeWindow object.
08:50Now the next video, I'll show you how to do all the exact same stuff, but this time in Flash.
Collapse this transcript
Creating transparent applications in Flash
00:00In this video, I'm going to describe how to create an AIR application in Flash CS3 Professional that uses a transparent initial window.
00:08I'll be working from an existing Flash document that's located in the Projects folder of the exercise files area for this video series.
00:16If you're following along with the exercises, go to the Projects folder underneath the exercise files area
00:22and locate the file StockQuoterFlash.ZIP.
00:26Extract the contents of this file and place the contents in the Flash folder underneath the exercise files area.
00:33In Windows Vista, I'll right-click on the file
00:36select Extract All.
00:38And then change the target folder to the Flash folder underneath the exercise files directory
00:44and click Extract.
00:46If you're using WinZIP or you're working on Mac OS X, follow the steps for extracting ZIP files in your environment.
00:53Now in the Flash folder, I'll go to the StockQuoterFlash folder, which contains my existing application
00:59and then double-click on the FLA file,
01:02and that will result in opening the application in Flash.
01:05If you've been working through all the videos in this chapter, this looked really familiar.
01:10It's the same application again. Once again, this application makes a Web service request to a Yahoo Web service,
01:17retrieves content and then displays the results to show a current stock price.
01:22I'll run the application,
01:24and you'll see that the application shows up with standard window chrome.
01:28I'll enter a symbol,
01:31click the Get Quote button,
01:32and I'll get back a response from the Yahoo service.
01:36Most of the code for this application is in the first frame of layer 1.
01:41I'll click into that frame, then go to the menu and select Window,
01:44Actions
01:46and show that the content is being retrieved from the Yahoo service using a class called URLRequest.
01:52I want to make a point before I continue on with this exercise that I've accomplished the same task in all three development environments.
02:00In Flex, I used the HTTP service object. In HTML, I used the XML HTTP request object and in Flash I used URLRequest.
02:09They're all the same sort of object. They know how to make an HTTP request to a Web server and retrieve content.
02:16And then I'm using either ActionScript 3 in the case of Flex and Flash, or Java script in the case of HTML to parse the results and present them.
02:25OK, so let's continue on with the task at hand. When you create a brand-new Flash document for AIR,
02:31you get an application descriptor file that has all the same properties I have described previously.
02:36Here is the default file and I'll show you what it looks like.
02:40I'll open it with WordPad. If you're following along, you can use whatever text editor you prefer,
02:45and then I'll show you that the default settings for the initial window are systemChrome set the standard,
02:51transparent set to false and visible set to true.
02:54Now I'll go back to Flash because I want to show you a feature that's been implemented in the Flash version of the application settings dialog.
03:02I'll go to the Command window,
03:04to AIR Application and Installer Settings,
03:07and then rather than change the values right here, I'm going to use a custom application descriptor file.
03:14I'll select that option and then click the Browse button,
03:18then I'll navigate to the folder that contains my application.
03:21It's under the exercise files area
03:23under Flash, StockQuoter Flash,
03:26and I have a pre-built version of this XML file called StockQuoterFlashtransparent.XML.
03:33This file'ss almost identical to the default version except that it has all the settings I need for transparency.
03:40That is to say, the systemChrome is set to none and transparent is set to true.
03:45I'll save the changes,
03:47close down everything and run the application again.
03:52And there's my application with transparent background. To show that the functionality the application is still intact,
03:59I'll click into the text input, type in a stock symbol,
04:02get the quote and get back the result.
04:05Now as I've shown in previous videos, at this point I'm no longer able to move the application around the screen.
04:12The window chrome, including the title bar on which the user normally clicks to drag the application, isn't there.
04:19There aren't any close buttons and minimize buttons and so on. So if I want that functionality I have to provide it.
04:25So I'll close the application. I press Alt + F4 on Windows or Command + Q on the Mac,
04:31and I'll come back to the code.
04:33In order to implement event handling, I need to make sure that any objects on which I want to capture the event
04:40are implemented as instances of movie clip objects. So I'm going to close my Actions panel and then show you that
04:53the two background elements are instances of a movie clip object called a GR background, and they each have an ID of BGform for the first one
04:56and BGOutput for the second one.
04:59So here's how I'm going to set up the ability to drag the application around the screen.
05:03I'll go back to the Actions window by selecting Window,
05:07Actions,
05:08and then I'm going add a function called startMove.
05:12Now the startMove function is going to be designed as an event handler function that receives an event object.
05:17And I'll show you why in a moment.
05:19But we're going to set it up to receive an event object typed as a mouse event,
05:24and return void.
05:30In the body of the function, I'll use the code this.Stage.nativeWindow.startMove. As I've shown in previous videos,
05:40calling the startMove method of the nativeWindow object results in causing the application's position to track
05:47the mouse movement. When the user releases the mouse button, the move operation is canceled and you don't have to write any
05:52additional code for that to happen.
05:55Now to make the move happened upon the mousedown event for those two background components,
06:00I'll add code at the top that executes as the application starts up.
06:04First, BGForm.addEventListener
06:11and I'll pass and MouseEvent.Mouse_Down
06:18And then I'll call the startMove method. This is why I set up the startMove method as an event handler function
06:25receiving an event object. When you set up an event handler using the addEventListener method, the functions that you
06:31call must receive an argument typed as the appropriate kind of event object.
06:36Now I'll do the same thing for the BGOutput background.
06:41Once again, I'll call addEventListener
06:49and once again, I'll call the startMove function when that event occurs.
06:56I'm ready to test my application.
06:58I'll run it.
07:03And now I should be able to click anywhere on the visible part of the application and be able to move it around.
07:09And there's the result.
07:11The functionality of the application is completely intact. I'll type in a symbol click the button and get back a response.
07:18And then I'll close the application with Alt + F4 on Windows or Command + Q on the Mac.
07:24So this is one of the ways in which you can handle an event in Flash and then trigger functionality of the nativeWindow object.
07:30So here are the steps I followed.
07:33Any object whose events I wanted to trigger this kind of functionality was set up as a movie clip instance.
07:39Then I used the addEventListener method to set up an event listener for the appropriate event.
07:45In this case, the mouse down event.
07:47And in reaction, called the function
07:50startMove in this case,
07:51and within the startMove function, I called the startMove method of the nativeWindow object of the Stage.
07:57This code looks almost identical to the version in Flex in the sense that there's an event listener but we're using
08:03ActionScript-based event listeners rather than an XML event-based listeners.
08:07And it's similar to the version in HTML. In HTML, we simply had to say nativeWindow.startMove rather then Stage.nativeWindow,
08:16but the basic functionality is exactly the same between the three development environments, Flex, HTML and Flash.
Collapse this transcript
9. Using File System Input and Output
Understanding AIR file system access
00:00In this chapter I'm going to describe some of the tools that are available that allow you to access the local file system
00:06from an AIR application.
00:08Local file system access is one of the great benefits of desktop applications in contrast to web-based applications, which
00:16are restricted by the browser security sandbox. When you install an application as a native local application, as you do with AIR applications,
00:32the application is allowed to access files, directories, create new directories, remove them, create new files, read existing ones and so on and so forth
00:34and AIR libraries anticipate this capability and make it quite easy to get to the local content and manipulate it as needed.
00:42All applications written for AIR have access to the local client's file system
00:47and as a result, the AIR libraries that include the fundamental components for file access are available to all
00:54applications, regardless of whether they're built using Flex, Flash or HTML.
01:00The AIR API libraries include classes that allow you to navigate the file system,
01:05search for local files and read and write local files.
01:09Then in addition to the different architectures, HTML, Flash and Flex, provides various visual tools.
01:16For instance, the Flex framework provides a rich set of visual components based on the data grid, list, combo box, and tree
01:24controls, that automatically know how to read the local file system and present information about the files and directories that are already there.
01:32Because they are interactive components, originally designed for presenting and manipulating data in a Flex application,
01:39you use them in pretty much the same way as you do their parent classes.
01:42If you know how to use a data grid, you already know most of what you need for a FileSystemDataGrid, and so on.
01:50The key classes in the AIR API for getting to and manipulating local content include the File and the FileStream.
01:58The File class represents a path to a local file or directory.
02:02It doesn't have to point to a directory or file that already exists because you also use the File class to represent
02:09a path to a file or directory you want to create.
02:12And then the FileStream class encapsulates all the functionality you need for reading and writing local files.
02:18It has the ability to read and write simple text files and also is able to deal with binary files.
02:26In addition to these basic AIR API classes, the File and the FileStream, of the Flex framework adds these visual components.
02:34The FileSystemComboBox and the FileSystemList define combo boxes or lists that are sensitive to the local file system.
02:43When you create them, you point them in a specific directory and then at run time these components go get information
02:48about the selected directory and present it to the user.
02:52The FileSystemDataGrid does pretty much the same thing but it displays much more detailed information about
02:58each file and each directory.
03:00And then finally the FileSystemTree control presents this information in a hierarchical display.
03:06Again, if you're familiar with the tree, the data grid, the combo box or the list controls in Flex, then you'll find these controls
03:13very easy to learn because they use exactly the same sort of programming architecture and add to those capabilities local file system sensitivity.
03:22This is one area where the tools in the Flex framework are more extensive than what you get in either HTML or Flash.
03:29The component-based architecture of the Flex framework encourages you to use these prebuilt components rather than building UI from scratch.
03:37But over on the HTML side, if you're familiar with some of the really great visual tools that are Ajax-based,
03:44for instance, Adobe Spry framework or the Dojo framework and open source Ajax library, it is pretty simple to use the tools in
03:53the AIR API libraries and feed data into these pre-built visual components.
03:57Similarly Flash CS3 comes with a set of components and you can take the data you get out of the area API and feed into those components.
04:06So in the next video I'm going to show you how to build an application in Flex that uses the FileSystemDataGrid and
04:14the File and FileStream classes to explore the local disk, select files
04:19and present the contents in an AIR application.
Collapse this transcript
Navigating the file system with Flex controls
00:00In this video I'm going to describe how to create an AIR application using Flex that allows the user to explore their
00:07local disk and select text files and display the contents on the screen.
00:12I'll be creating this application from scratch and Flex Builder. So if you're following along in the exercises, close whatever
00:18projects you currently have open in Flex Builder
00:21and then from the menu, select File,
00:24New, Flex Project.
00:27Name the new project FileReader,
00:31Make sure its application type is set to Desktop application
00:34and click Finish to create the project and the main application file.
00:40Once the application loads, set its layout property to vertical.
00:45I'll do that in Source view, just locate the layout property,
00:49remove absolute and then start typing vertical and press Control + space to complete it. Next within the windowed application tags,
00:57declare an instance of the FileSystemDataGrid.
01:01Notice that there are a quite a few different components you can use. I described the combo box, the list control, the tree.
01:08We'll use the DataGrid because it gives you the most detailed information.
01:12Set the ID property of the FileSystemDataGrid to fileGrid then save the changes to your application,
01:21and click the Run button on the toolbar to run your new AIR application.
01:28When the application opens up, it displays a data grid and populates it with the root contents of your local system.
01:35Working on Windows, I see a list of drives. If you're working on the Mac, you'll see the root of your hard disk.
01:41Notice that the data grid displays the name of the directory or file,
01:45whether it's a folder or file.
01:48Its size, if it's a file,
01:50and it's created and modified dates.
01:53One of the built-in features of this component is that you can double-click to drill down into the directory contents.
01:59So I'll double-click into the C drive,
02:01and there's my AIR Essential Training folder, which contains my exercise files for this video series.
02:07I'll double-click on that folder and that takes me down into the directory structure, which to a be familiar with if you've
02:13been working through these exercises.
02:16Notice that there's no built-in functionality for navigating upward through the directory structure, but that's something
02:22is pretty easy dad with a little bit of code.
02:25Close the application and returned to Flex Builder.
02:29Then place the cursor under the FileSystemDataGrid declaration and add a button component.
02:35Set its label property to up
02:38and its click event listener to call this bit of ActionScript code,
02:43fileGrid.navigateUp.
02:47Notice that there are a number of different navigate functions.
02:50navigateForward, navigateBack,
02:52navigateUp, navigateDown and navigateTo.
02:55So you can programmatically walk the directory tree.
02:59I'll select the navigateUp method of the grid control, close the tag and once again run the application.
03:09I'll expand the size of the application so I can see the entire grid. I'll double-click on the root almonds to drill down into the folders.
03:17And then each time I click the Up button, I'll be navigating upward through the directory structure.
03:25If you want to find out which item is currently selected in the FileSystemDataGrid, you can use a property called selected path.
03:32If you're familiar with the dataGrid component, it is very similar to the dataGrid's selected item property.
03:38The selected path property returns a string, which reflects the currently selected item in the FileSystemDataGrid.
03:45I'll add a label control above the FileSystemDataGrid and set its text property using a binding expression
03:53fileGrid.selectedPath.
03:58I'll run the application.
04:03I pressed Control + F11. If you're working on Windows, you can do that or if you're working on a Mac, you can press Command + F11.
04:11And now each time I select an item, you'll see the label component above the dataGrid that's showing my current path.
04:18I'll double-click to drill down
04:20and each time I select an item in the data grid, I'm showing the current path.
04:24Finally one more task for this video. I'd like to show you how to set the FileSystemDataGrid's currently selected item
04:32upon application startup.
04:34I'm going to create a script section and within the script section, I'll create a function called initApp and this would be
04:42my application initialization function.
04:45It will return void,
04:48and then I'll go to the root element of windowed application and add a creationComplete event handler and call the method initApp.
04:58Within the method, I'm going to set a property of the grid named directory.
05:04The directory property points to an instance of the file class and this will be a first look at the file class.
05:10When you instantiate the file class, you can pass in a path, a string that describes the file or directory you're interested in.
05:18I'll set it like this, fileGrid.directory = new File
05:26and then within the constructor method of the File class, I'll pass in the location of the file.
05:32And here's what is an important distinction between Windows and the Mac.
05:36The Windows operating system uses backslashes.
05:40Where as the Mac operating system uses forward slashes.
05:43In fact, even when you're working on Windows you can use forward slashes to designate file paths and it's typically a little bit
05:51easier to do. Because if you want use backslashes, you have to double them up. So for instance, if I wanted to point to
06:05my exercise files directory on Windows, and I wanted to use back slashes, I would have to type it like this C:\\AIREssentialTraining,
06:11Now this exercise only makes sense on Windows.
06:14If you're Mac user, don't worry about this. You should use forward slashes all the time, but notice that I'm putting in
06:20a double backslash there.
06:22And then I'll run the application.
06:25And I automatically come up in that directory from the very beginning.
06:30If I prefer I can use forward slashes instead, even though I'm running on Windows and then I only need a single forward slash.
06:38I'll save the changes.
06:40Once again, run the application,
06:43and once again, I get to the correct location.
06:46That's a beginning look at how to use these visual components. In the next video on so you had to read a file from disk and present it on the screen.
Collapse this transcript
Reading and displaying text files
00:00In this video I'm going to describe how to add functionality to my Flex AIR application that knows how to read files
00:07from the local disk and display their contents in the application.
00:11The code I am going use for this purpose is pretty much the same, regardless of what you're working in Flex HTML or Flash.
00:18So unlike previous videos where I repeated the exercises three times. I'm only going to do this one once because
00:25the basic code that you use is pretty much identical.
00:28I'll be working on the same application that I created in the previous video, FileReader.MXML.
00:36I'll start by creating a button at the bottom of the application and when the user clicks this button and I'm going to use
00:42the file that they've selected from the FileSystemDataGrid control and present it on the screen.
00:48I'll start by creating the button,
00:50and now give it the label of Read File.
00:53Now I can only read a file and not a directory.
00:57So I'd like to disable this button if in fact they have selected a directory in the grid.
01:02The FileSystemDataGrid component's selected item property
01:06always points to an instance of the File class.
01:09And every File object has a property called isDirectory,
01:13which is a Boolean value that you can inspect to find out whether you're working with a directory or file.
01:19I'll add an enabled property and I'll use of binding expression that looks like this.
01:25I'm going to expand the application to full screen so I can see more of the code,
01:30and then I'll use this binding expression. I'll start off with the !, the negation operator,
01:37and then I'll put in fileGrid.selectedItem.isDirectory.
01:43The logic is that I only want this button to be enabled if I'm looking at a file.
01:49If I'm looking in a directory, I want to be disabled.
01:52I'll save and run the application
01:57and then I'll exapnd the size the application so I can see more of it.
02:00Notice when I click on a directory, that button is disabled.
02:05I'll double-click into that directory and select a file,
02:08and now the button is enabled.
02:10So now I have a button that the user can click.
02:13Now when the user clicks the button, I'm going to open the file from disk and display its contents on the screen.
02:19My next task is to create a user interface for displaying the contents of the file. I'll create a panel component with
02:27the title of File Viewer
02:30and I'll set its width to 300 pixels
02:36and its height to 200 pixels.
02:40Within the panel, I'll create a text area control
02:44and I'll assign an ID of Text Viewer
02:48and give it a width and height of 100% each so that the text area control fills the entire panel.
02:56And then I'll put in the /> to close the text.
03:01Next, I'll create a function that knows how to read the file from disk.
03:06Go to the script section and create a new private function
03:10and name it displayFile. The function should return void.
03:17Within the function declare a new variable named currentFile and data type it as an instance of the File class.
03:26Then construct the object with the File class's constructor method and pass in the selected path from the grid.
03:37The selectedPath property returns the location of the selected file as a string. You take that string you pass it into
03:46the File class's constructor method and now you have an instance of the File class that represents that file on disk.
03:54To read the file from disk, we're going use a class called the FileStream.
03:58I'll declare new variable called stream data typed as FileStream.
04:03And then I'll instantiated using the class's no argument constructor method.
04:09Now I'm going to open the file from disk.
04:13When you open a file, you can open it in a number of different modes
04:17and the different modes represented in a class called FileMode.
04:21To open the file, I'll use this syntax-
04:23stream.open
04:25then I'll pass in a variable representing the file on disk and then I'll use the FileMode class,
04:31and you'll see that there are four constants available, for append, read, update and write.
04:37I'm going to read the file, so I'm going to select the READ constant and then close the method call.
04:44And I now have a handle the allows me to read the file from disk.
04:48When you read the file you can either do so synchronously or asynchronously.
04:53For a very small file, synchronous operations work fine, but if you're reading a very large file, you might want use asynchronous operations.
05:01I'm show you how to do synchronous reading.
05:04It'll look like this.
05:05I'll create a new string variable called fileText. I'll datatype it as a string.
05:12Then I'll call a method of the FileStream object named readUTFbytes.
05:19You'll see in the list that I'm showing on the screen that there are many read functions. The readUTFbytes function
05:25specifically allows you to read UTF-8 encoded text.
05:29And that's the kind of text my files is going to have.
05:33You pass a numeric value into this function,
05:36and you can find out how many bytes there are available by looking at the FileStream object's bytesAvailable property.
05:43So I'll pass this expression in as the only argument in the readUTFbytes function.
05:50stream.bytesAvailable.
05:53Now the fileText string will contain the text of the file I just opened.
05:59The last step is to take that string and assign it to the text area control that I'm using to present it to the user.
06:06So I'll use that object ID, Text Viewer, and assign its text property to fileText.
06:14The last step in this application to glue it all together is to go down to the button that I previously created that
06:21has the label of readFile,
06:24and add a click event handler,
06:27and call the displayFile method.
06:30So now when the user clicks the button, it will open the file from disk and display its contents on the screen.
06:36Now I'll test the application.
06:38I'll save my changes and run the application by clicking the Run button on the toolbar.
06:44I'll maximize the application.
06:47I'll double-click into the Assets folder
06:50and locate the text file, simpletext.txt.
06:53Notice that the Read File button is now enabled,
06:57and I'll click the button,
06:58and there's the contents of the text file.
07:01With a small text file like this, it will open very, very quickly.
07:05Now, I've set up this code to read text files. If I try to open a PNG file for instance, I'll just get a binary string.
07:13Same thing with PDF files.
07:15Or if I go to my icons folder, where I created custom icon graphics for a previous exercise, once again, I won't be able to
07:23read and present the contents of these files because they're binary files, not text files.
07:28But this give you a start in understanding how to get to the local disk, read files from the disk and get their contents out.
07:35Once again, I'll select the text file,
07:37click the button, to leave you with the successful exercise in getting contents for the users local disk and presenting it in an AIR application.
07:46Now if you're an HTML developer, the steps are almost exactly the same.
07:51The File and the FileStream class are accessible from the AIR object that you have available when you've linked in the AIR Aliases.
07:59And in Flash, these classes are available all the time because Flash uses exactly the same set of actions for libraries that Flex does.
08:07So regardless of whether you're an HTML, Flash or Flex developer, you're able to get to the local disk, open the files
08:15and present them to the user.
08:17You can also write files to the local disk. I won't be getting into those techniques in this video series, but in each of
08:24the follow-up series to this essential training, the ones for each of the individual development environments, Flex, Flash, and HTML,
08:31you'll learn not only how to read and use more complex files but also how to write content to the local disk.
08:38You'll also learn how to use the embedded database engine that's a part of the Adobe integrated runtime
08:43to store complex relational data and cache it on the client. [00:08:48.6 6]
Collapse this transcript
10. Distributing Applications
Understanding the seamless installation experience
00:00In this video I'm going to describe how to create a seamless install for an AIR application.
00:06The goal of the seamless install process is to allow your user to install both your application and the required runtime
00:13at the same time. So that instead of having to go find the runtime and install it separately, they'll be able to go to a page
00:20on your website and with just a few clicks, install everything they need to get started with your application.
00:26The AIR software developers kit or SDK includes a couple versions of the required files.
00:32I've open Windows Explorer to the AIR SDK folder,
00:36and if you like to follow along in this exercise, you do the same.
00:40Regardless of where you installed the software developers kit, whether on the C drive,
00:44Or if you're working on a Mac, in the Applications folder, just navigate there in Windows Explorer or finder.
00:50First let's look in the SRC folder.
00:52This folder contains a subfolder called Badge,
00:56and within that folder there are two files names badge.FLA and AIRbadge.AS.
01:02The badge.FLA file is a source code file for Flash that contains the visual presentation of the badge.
01:09The other file AIRbadge.AS is an ActionScript file that contains all the logic.
01:15The FLA file is provided to use so that you can customize the look of the badge if you like.
01:20The two files depend on each other and the ActionScript file contains all the logic for implementing the batch.
01:26It's strongly recommended that you do not change the ActionScript code in the AIRbadge.AS file, but if you're comfortable
01:32working in Flash, you can use the FLA file to generate your own copy of the badge.
01:38Now the binaries for these files and all the supporting files are contained in another folder of the AIR SDK named Samples.
01:46Under the Samples folder there's a Badge folder,
01:50and here you'll find a number files that I'll describe.
01:54First the bagde.SWF is the compiled version of the Flash application that creates the seamless install experience,
02:01and then there's a JavaScript file AC_RunActiveContent.JS
02:06that's designed to load the Flash content correctly in the browser.
02:09If you decide to work with the precompiled versions of this application, you won't need to change anything about the JS or the SWF file.
02:16Next, there are two HTML files named default badge.html and red badge.html.
02:23These are the files that you'll change to work with your application.
02:27I'm going to open default badge.HTML in Dreamweaver so we can take a look at the code and I'll describe the different
02:34options and how it can be used.
02:36Now if you don't have Dreamweaver, you can open this file in any text editor you like.
02:41I've opened the file in Dreamweaver and pressed F4
02:44to display it in full screen, and I'm going to scroll down toward the bottom of the file to the important section.
02:50The call to the function AC_FL_RunContent loads the badge installer.
02:55In order to configure this file, you'll modify the Flash var section, at line 55 in my copy of the file,
03:03and you'll provide a few required properties.
03:06The appname property should match the name of your application as it was described in the application descriptor file.
03:12The appURL should point to the location of your AIR file,
03:15and should actually be a complete URL starting with HTPP and designating the exact location of the AIR file on the web.
03:23The AIR version property should be a value of 1.0.
03:27if you're building the application for that version of AIR.
03:30Older versions of application might have valuea such as 1.0.M6. That would refer to the Beta 3 release of AIR.
03:38If you're building your application for the 1.0 final release, it should be simply 1.0.
03:44And then the imageURL is the name of a graphic that you can plug into the badge to customize its look and feel.
03:51This graphic should have a fixed size of 215 pixels wide and 100 pixels high.
03:57Now I'll show you in the next video that I've created my own version of this graphic that I can present to the user.
04:03Do that one line of code is the only thing that you have to customize to make this badge work with your application.
04:10There are a couple of other files in the folder. The readme.txt file is just informational.
04:15You don't need to include that in your copy of the files.
04:18and test.jpg is a sample graphic. It's sized correctly for this version of the bad and so if you want to customize
04:26the look of your application, you can plug in your own graphic and then reference it in the Flash vars property within the HTML.
04:34Now in the next video, I'll show a how to package all this together and post your application up on the website so that
04:41users can run through the seamless install experience.
Collapse this transcript
Testing the seamless install with a web server
00:00In order to properly test the seamless install on your local system, you'll need to have installed a Web server product.
00:07Any Web server will do the trick. For instance, if you're working on Windows and you already have Internet information services installed, use that.
00:15If you're working on Mac OS X and you know how to use the Apache Web server that packaged with the Mac,
00:21you can use that as well.
00:23If you need a Web server package, I recommend going and getting one of these packages.
00:29Wamp or Mamp. Wamp is a free integrated server package that includes the Apache Web server, the PHP application server
00:37and the my SQL database.
00:39It's easy to download and install,
00:41and when you install it on Windows using the default settings, it will create a web root folder under C:\WAMP\WWW.
00:53You'll then be able to copy files into those locations and load them from the Web server and see how everything will
00:59behave in a Web server environment.
01:01You can download the Wamp software from this URL,
01:04www.wampserver.com.
01:08If you're working on a Mac and you want a similar package, go to www.mamp.info.
01:14On the main screen, there are two links, one for Mamp Pro and one for Mamp.
01:19Mamp itself is free and has everything you need.
01:22Once again, it includes Apache, mySQL and PHP.
01:27Now in these demonstrations I'll be using Wamp, the version for windows, and I won't be using to mySQL database or the
01:35PHP application server. The only purpose in installing the software for the purposes of this video is to make sure that
01:42I have a Web server running on my local system that I can easily use for testing of the seamless install experience.
01:48So in the next video I'll show you how to create the seamless install experience and test it on your local system and
01:55where ever I refer to the Wamp server, you should just use which ever Web server you have installed on your local system.
Collapse this transcript
Installing WAMP on Windows
00:00For the next set of exercises in this video series, I'm going to need an application server.
00:06Flex applications are able to communicate with a number of different application servers
00:10including Cold Fusion, ASP.net,
00:13Live Cycle data services or its open source version, Blaze DS.
00:18But one of the simplest to install and setup is PHP with Apache and mySQL.
00:24I like this particular combination for a beginning application server,
00:28because there's a version of these products that you can download and install for free that wraps Apache, the Web server,
00:35mySQL, the database, and PHP, the application server, in a single package.
00:41There are versions of yhis for many operating systems. In this video I am going to show you how to get and install a version
00:48called Wamp, which stands for Windows, Apache, mySQL and PHP on Windows.
00:55You can get this software for free from the URL displayed on the screen at www.wampserver.com/en.
01:04You can download this file and install it easily without paying for any license fees and Flex Builder will do a great
01:11job working with this application server, generating code for your applications.
01:16I've already downloaded the installation file to my desktop,
01:20where it's located and named for WampServer 2.0a.
01:24I'm going to show you how to install it and you'll find that it's very, very simple.
01:28I'll double-click on the WampServer icon
01:31and click Run.
01:34You'll get an informational message,
01:36indicating that if you have an older version of the Wamp package, you should explicitly uninstall it and delete it
01:42before you install this version.
01:44I'll click Yes to indicate that I want to continue the installation.
01:48Then click Next.
01:50If you accept the agreement, just click the radio button and click Next again.
01:55And then indicate where you want to install the Wamp server package.
02:00This is going to be a root directory that includes the installations of Apache, mySQL and PHP all wrapped together.
02:09Click Next
02:11and then indicate what you want particular icons to appear.
02:14I'm going to install without any icons and click Next again.
02:20Finally I see a summary screen that indicates that the application installation is ready to go.
02:25I click Install
02:27and installation starts.
02:29It takes just a few minutes for the installation to complete.
02:32And remember that we're installing everything you need, including a database, a Web server,
02:38and an application server.
02:40One important note about this installation.
02:42Apache installs on the standard port of 80.
02:46Meaning that it's going to be listening for requests from the browser or from your Flex applications on the same port as
02:53other Web servers might be using.
02:54If, for instance, you all read have Internet information services installed on your system you should deactivate
03:00Internet information services before you install Wamp.
03:04Or you can go into the configurations for the two servers and change one of them from the default port 80 to some other port.
03:11My recommendation though is that for development purposes, you should choose which Web server you prefer to work with
03:17and primarily work with that one.
03:20During the setup, the Wamp installation notes that I have Firefox detected on my computer and asks if I'd like to use it
03:26as the default browser.
03:28Sure. I'll use Firefox. I tend to move back-and-forth between the two major browsers, Firefox and Internet Explorer,
03:35and find that they both do the job just fine.
03:38Next you're asked for a couple bits of information. If you have an SMTP server, you can now configure PHP so that
03:46it knows where to send e-mails through.
03:48I don't have one of those installed right now, so I'll just go to the next screen.
03:52And now I'll go ahead and click Finish and launch the server all at the same time.
03:58After a few moments the server will have started up in the background.
04:02Here are two ways to verify that everything started up.
04:05First, I'll go to a web browser,
04:08and I'll type in the URL http://local host,
04:14because Apache installs on the standard port 80, I don't need any more than that.
04:20And I should see this screen indicating that the server is running in the background.
04:25It tells me which version of each software package were installed.
04:28Apache version 2.2.6,
04:31PHP 5.2.5,
04:33and mySQL 5.0.45.
04:36There are also links down at the bottom of the screen to various applications that will be useful.
04:42For instance, PHPmyadmin is a web-based interface for managing a mySQL Server.
04:48I'll use that in one of the later videos to set up a database.
04:51SQLitemanager is a web-based interface for managing SQLite databases.
04:57Scrolling down a little further,
05:00you can set up virtual directories or aliases using the Wamp interface,
05:04and those aliases are listed on this homepage as well.
05:08The Wamp administrative interface appears in your system tray.
05:11I'm going to double-click on the Wamp icon in the system tray and you'll see in a battle dialog that shows you
05:17which version of the Wamp server package was installed.
05:20I'll close that dialogue,
05:22come on back to the system tray and single click,
05:25and you'll find a very intuitive interface
05:27that allows you to start and stop services as needed.
05:31You can start and stop all the services from this interface or on the Windows platform, you can go to the Control Panel.
05:39From the Control Panel, go to the classic view,
05:43to Administrative Tools,
05:46to Services.
05:48Within the Services window, you should find two services listed as Wamp.
05:54They're named WampApache
05:56and WampmySQLd.
05:58They're listed individually and can be stopped and started manually from this interface.
06:03Notice that they are radically set up as manual services,
06:07which means that if you restart your computer,
06:09they won't restart automatically upon application startup.
06:12If you want them to do that, you need to configure that in this Services area.
06:17So that's how easy it is to get started with the combination of Apache, mySQL and PHP.
06:24In the next video, I'll show you how to do the same installation on Mac OS X, if you're working on a Mac and then I'll show you
06:30in a later video how to use Flex Builder to interact with the PHP application server, the mySQL database and the Apache Web server
06:39to generate a project from a database structure very easily.
Collapse this transcript
Installing MAMP on Mac OS X
00:00In this video, I'm going to describe how to install Mamp, the installation of a combined server install that
00:07includes Apache, mySWL and PHP designed for Mac OS X.
00:12This is a free download and install that you can get from the website I have shown on the screen www.mamp.info.
00:21In order to get a copy of the Mamp server,
00:23navigate to this site and then download the Mamp install.
00:27Notice that there are two versions, Mamp Pro and Mamp,
00:31the free version is Mamp.
00:34Click the Mamp button and then download the software from here.
00:38Before you install the Mamp server, make sure that your Apache server that's included with the Mac OS X operating system isn't active.
00:46To check this, go to your System Preferences.
00:50Go to the Apple menu and click System Preferences.
00:53Click Sharing,
00:56and then check Web Sharing.
00:58If Web Sharing is turned on, that means you're already running the Apache server and you may run into a conflict
01:04between that and the Mamp server.
01:06Turn it off.
01:07And then close your System Preferences.
01:11Now for the installation.
01:13When you download the Mamp server, you'll get a DMG file. Double-click the DMG file
01:19and then if you agree with the license agreement, click Agree,
01:23and you'll open up the DMG file.
01:27The installation of the Mamp server is very simple.
01:30Just click on the Mamp folder
01:32and drag it to the Applications folder.
01:35The installation takes just a few seconds while files are being copied over.
01:39Once the installation is finished, double-click the Applications folder
01:43and navigate to the new Mamp folder.
01:48Within the Mamp folder, you'll find an application named Mamp.
01:52Double-click to open and start the Mamp servers.
01:56You're starting two different servers, the Apache Web server and the my SQL database server.
02:02When you first install this software, custom ports are assigned to the Apache and mySQL servers.
02:08The Apache server, for instance, is running on port 8888.
02:13You typically want to make sure that the servers are running on their default ports.
02:18To reset the ports, return back to the Mamp Control Panel
02:22and click the Preferences.
02:25Click the Ports button
02:28and then click the button Set to default Apache and mySQL ports.
02:32Then click OK.
02:34This will restart both the Apache and the mySQL database servers.
02:42At this point Mamp asks you to type in your administrator password.
02:46This is your Mac user password.
02:49Then to test the installation, click the Open start page button
02:53and you'll see the at the Apache server is now running on port 80.
02:56This is the port that you should use as you work through the rest of the exercises in this chapter of the video series.
03:02You also might want to reset the home directory of the Apache server.
03:08Once again click the Preferences button,
03:10then click the Apache button.
03:12Notice that the document root for the Apache Web server
03:15is in the Applications/MAMP/htdocs folder.
03:19I usually prefer to place this htdocs folder in my Sites area underneath my personal directory.
03:26To make this change click the Select button.
03:29Then navigate to your personal directory.
03:32From there to Sites,
03:34and then click Open.
03:36Then back in the Mamp dialog box, click OK
03:41and you'll see that the servers are restarting in the background.
03:45Now click Open start page,
03:48you'll still see the default Mamp homepage.
03:51If you look at the URL, you'll notice that you're pointing to an alias named mamp, which is still back in the Mamp installation directory.
03:58But to see your personal startup page in your sites folder, remove everything except the URL http://local host
04:07and press Return.
04:08And you should see the default homepage that was installed with Mac OS X.
04:13As you work through the remainder of the exercises in this video, I'll be doing my demonstrations on Windows using Wamp,
04:20the Windows version of the integrated installation.
04:23The folder in which I'll be installing all of the PHP files on Windows is C:\Wamp\WWW.
04:32If you're working on a Mac, you should replace that with your personal Sites directory, under Users, your user name
04:40and then Sites.
04:42Other than that, the two products work pretty much the same.
04:45Two more tips about using Mamp.
04:48First of all,
04:49keep the Mamp Control Panel open. When you close it, you're shutting down both the Apache and the mySQL servers.
04:55Second, I'll be demonstrating the use of an application called PHPmyadmin, which is an administrative interface for mySQL server.
05:04To locate this administrative application on Mamp,
05:07go to the Control Panel and click Open start page,
05:11and click PHPmyadmin.
05:14From here the interfaces look exactly the same between Mac OS X and Windows. You'll be able to import and inspect
05:21the database that I'll use in the remainder of these exercises
Collapse this transcript
Creating the seamless installation experience
00:00In this video, I'm going to describe how to use the sample files from the AIR SDK and your AIR file that you've packaged to create a seamless install.
00:09If you're following along these exercises, go to the exercise files area,
00:13to the Projects folder
00:15to the HelloWorld folder.
00:17This is one of the applications that was created earlier in this video series. It's a HelloWorld application that uses HTML
00:24and a little bit of JavaScript code.
00:26The AIR file has already been built and is ready to use.
00:30Your first step in creating a seamless install experience is to create a folder under a Web server directory.
00:37where you can test the installation correctly.
00:39I'm going to go into Windows Explorer, if you're working on a Mac, go into Finder,
00:44and then navigate to your web root.
00:46I've installed Wamp,
00:48the integrated server package that includes Apache,
00:51and I'll navigate to the C drive
00:54to Wamp, to WWW.
00:57If you're working with another Web server or working on the Mac, navigate to your web root folder.
01:02Next create a new folder
01:05and name it HelloWorld. Now go back to the folder under the exercise files area that contains the application
01:15and the AIR file that's the installer.
01:17Copy that AIR file to the clipboard,
01:20return back to your web root folder and paste the file into the new folder that you created under the web root.
01:28That's the first piece of your seamless install experience.
01:32Next go back to the AIR SDK folder.
01:35I have it installed under c:\AIRSDK.
01:39From there, go down to the Samples folder,
01:41and from there to the Badge folder.
01:43Here are the files that you need to select and copy:
01:46AC_RunActiveContent.JS. That's the JavaScript library.
01:51badge.SWF, the precompiled badge, default_badge.html and test.jpg.
01:59Copy those files to the clipboard,
02:01and then once again return back to your seamless install folder,
02:04and paste the files.
02:06So you now have five files in your seamless install folder.
02:10The AIR file, which is your installer,
02:12The badge.SWF, the HTML wrapper for the badge, the JavaScript library for the badge and the graphic that the user will see as part of the badge.
02:21The next step is to customize the HTML file that wraps the badge file.
02:27Open the file in any text editor.
02:30I'll open it in Dreamweaver,
02:33and then once the file is open, scroll down to the section that calls the function AC_FL_RunContent.
02:40Go to the Flash var declaration.
02:42Notice that there are these three properties, appname, appURL and imageURL.
02:47Change the appname to the name of your application, as it was known in the application descriptor file.
02:54This application was simply known as HelloWorld.
02:57Next change the appURL property and type in the location of the AIR file as it will be known to the web browser.
03:04You need to put in a full URL, including the HTTP prefix. I'll put in http:/localhost/HelloWorld,
03:15that's the name of the folder containing these files,
03:18and then HelloWorld.AIR, the name of the installer.
03:23For the moment I'm going to leave the imageURL alone. I'll leave it set to simply test.jpg.
03:28I'll save the file,
03:30and now I'm going to open this HTML file in a web browser.
03:34You can use whichever web browser you usually use for this process as long as the Flash Player has been installed.
03:41In order to run the install badge,
03:43the user's browser must have at least version 9 of the Flash Player installed.
03:48Now I'll navigate to the location of my badge file, it's local host/HelloWorld.
03:55And I'll see a listing of all the files. Now at this point, if you're having any trouble finding the files
04:01you may need to go back and troubleshoot your Web server installation.
04:04Notice my file default_badge.HTML is listed here.
04:08I'll click the link.
04:10So this is the default appearance of the badge. I'll click the Install now link
04:15and the badge application notices that I don't have the Adobe integrated runtime currently installed.
04:20It asks me if I want to install the runtime.
04:23I'll click Yes.
04:25It takes a few moments to download the installer for the AIR runtime from the Adobe website.
04:31And then I see my application installer.
04:34I'll click the Install button,
04:36and as you've seen in previous videos, you now see the application install user interface.
04:41I'll click Continue.
04:43If I agree to a license for the Adobe integrated runtime, I click Agree.
04:47And now the installation of both the application and the Adobe integrated runtime happens all in a single process.
04:54Because I selected the option to open the application upon completing the installation it pops up and is available for immediate use.
05:02When the user encounters another application, either from you or another developer, that requires the same version of the
05:08Adobe integrated runtime, this time they'll just be installing the application because the runtime will already be installed on their system
05:21and the badge application is capable of detecting that state and making sure that they're not having to install the runtime yet again.
Collapse this transcript
Customizing the Install Badge's appearance
00:00In this video, I'm going to describe how to customize the appearance of the installation badge.
00:05There are a number of properties that you can set in the installation badge through the Flash variables.
00:10You can control, for instance, the background color of the button and the foreground color of the text on top of the button
00:16that shows the text, Install now.
00:18But you can also change the graphic that's displayed.
00:21The default badge that's delivered with the SDK samples expects a graphic of a particular dimension,
00:27215 pixels wide by 100 pixels high.
00:31You can create any graphic of the appropriate dimensions and easily integrate it into the badge presentation without
00:38having to re-open the source code for the badge and recompile it in Flash.
00:43You do this through Flash variable settings.
00:46Now I've already created a simple graphic so I can plug it in on top of this default map image.
00:51Once again, I'll remind you that I'm not a graphic designer, so what you're about to see is definitely programmer art.
00:58If you're following along in the exercises,
01:00go to the exercise files folder,
01:02and from there to go down to the Assets folder
01:05and you find the file there named HelloWorldBadge.PNG.
01:08This file is of the appropriate size, 215 pixels wide by 100 pixels high.
01:14Copy this file to the clipboard
01:17and then navigate back to the folder in which you created your seamless install
01:21and paste the graphic file into that location.
01:25Next to open the HTML wrapper file for the badge,
01:28which is currently named default_badge.HTML.
01:32I'll open the file again in Dreamweaver and locate the Flash vars setting within the call to AC_FL_RunContent.
01:40Reset the imageURL property to the name of your file.
01:45My file was named HelloWorldBadge.PNG
01:50and again, make sure that you copied this file into the same folder along with the badge itself.
01:57I'll come back to Dreamweaver, save the changes.
01:59Then come back to the browser where I'm displaying the badge and refresh and you'll see that my graphic is now plugged into the application.
02:07Now as I mentioned there also properties that you can use to reset the colors of the button at the bottom of the badge.
02:14These properties are named button color and message color.
02:17You set them through the Flash var setting within the HTML wrapper.
02:21So once again, I'll return back to the HTML file.
02:24I'm editing in Dreamweaver but you could use any text editor you like.
02:28Place the cursor inside your Flash var section.
02:31Make sure that the cursor is right inside the closing single quote, after the name of the image.
02:37Then put in an ampersand, to separate the new property from the previous ones.
02:42Type the name of the property want to set, buttoncolor.
02:45Then put in the equals assignment operator,
02:48and then type in the color that you want.
02:51Colors must be assigned using six character, hexadecimal color values. You can not use named colors in this context,
02:59and you don't include the # sign at the beginning.
03:02So for instance, to change the color of the button to red, I would type in the hexadecimal value for red, FF0000.
03:11I'll save the change,
03:13come on back to the browser, and refresh again, and you'll see that the color of the button is now red.
03:19The AIR SDK under the Samples folder includes an example of a file that's been customized.
03:25If you navigate to your AIR SDK folder and from there to Samples,
03:29and from there to Badge,
03:31you'll find a file there called red_badge.HTML.
03:35Open that in any text editor, I'll once again use Dreamweaver.
03:39Once you've opened the file, scroll down to the section of code that's calling the Flash Player, that's the call to a AC_FL_RunContent,
03:46and you'll see that this version of the file sets the button color and the message color in addition to the imageURL.
03:53So those of the properties that you can use to exert visual control over the badge application.
03:58Once again, the software developers kit includes the source code for the Flash application that is the badge.
04:05You can modify that, change its dimensions and make it look how ever you want to. The only part of the installation that
04:11you shouldn't change if you do work with the source code is the ActionScript file, because that ActionScript file contains
04:24all the code and logic that's needed to detect whether the runtime already exists on the system and to actually execute
04:24the integrated seamless installation of both the Adobe integrated runtime and the application.
Collapse this transcript
Conclusion
Goodbye
00:00Hi, this is David Gassner again.
00:02Thank you for joining me in this video series, AIR 1.0 Essential Training.
00:06In this series you learned how to use the Adobe integrated runtime to build and deploy desktop applications built with Flex, HTML and Flash.
00:15In the followups to the series, you'll be able to select from three titles that are dedicated to the different technologies.
00:21Regardless of which technology you select as your primary entry into AIR application development, these titles will
00:27show you how to manage files on the server in a more advanced fashion,
00:30how to leverage the database that's integrated into the Adobe integrated runtime, and more.
00:35So thanks for sitting through the training, and I hope you feel ready to build and deploy some great desktop applications.
Collapse this transcript


Suggested courses to watch next:

AIR for Flex Developers (2008) (6h 39m)
David Gassner


AIR for Flash Developers (2008) (7h 2m)
David Tucker


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,141 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,025 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked