- Updated the code to resolve breaking changes.
The WebKit control was reworked a fair bit for Beta 3. mx.controls.HTML no longer delegates the heavy lifting to flash.html.HTMLControl. So this meant a code sweep to change snippets like:html.htmlControl.historyBack()becomeshtml.historyBack().html.htmlControl.window.document.titlebecomeshtml.domWindow.window.document.title.HTMLUncaughtJavascriptExceptionEventbecomesHTMLUncaughtScriptExceptionEvent.
- Updated the
-app.xml
Another beta, another-app.xmlschema.
All the same values are set, but the precise location and names within the XML have changed again. I can see in the SDK that there is a template for these in sdk/templates/air/descriptor-template.xml. I just wish that Flex Builder provided a config panel interface to set this stuff, just like it does for the HTML wrappers. - Updated the badge installer
This beta included another update to the badge installer, so I have included this in the source update. - Added the new EverythingFlexAIR.SWC library
DryerFox was already using Rich Tretola's UpdateManager class, and Rich has now packaged this (and other useful goodies) in a SWC, available here. - Updated SWFObject to v2 RC1
SWFObject has moved to a release candidate, so I updated my copy. No other changes required.
Wednesday, January 2, 2008
DryerFox - Updated for Flex 3 Beta 3
Wednesday, October 3, 2007
DryerFox - Moxie Beta 2 Upgrade Completed
Click on the "Install Now" button in the sidebar to get the latest DryerFox executable, or click here for the source.
Updating from AIR Beta 1 to AIR Beta 2
This step was pretty straight forward. The foo-app.xml schema has changed (again!) in FB3B2, so the simplest thing to do (and the sequence recommended in the release notes) was:- Create a new AIR project
- Cut-n-paste the few project descriptors and icon paths from the old project to the new project. The same information exists in both projects, but the location of each XML node has changed.
Once DryerFox was compiling in FB3B2, I found that the
stage.window property was renamed to stage.nativeWindow, so I have to update the startMove(), minimize(), and close() handlers. That took another 5 minutes, and then DryerFox was up and running again.Adding UpdateManager
This was quite straightfoward. Kudos to Rich at the EverythingFlex blog for posting this useful class.- I copied the com.everythingflex.air.managers.UpdateManager.as class to my project.
- I created a version.xml that matched the new version in -app.xml
- Added the following two lines to the onAppInit() method:
import com.everythingflex.air.managers.UpdateManager;
var um:UpdateManager = new UpdateManager("http://www.dryerfox.com/blog/DryerFox/version.xml");
Seamless Installation update (imageurl is gone!)
I followed the instructions in the AIR release notes, and updated my install badge to the latest version bundled in the SDK. This folder can be found at "installRoot/Adobe Flex Builder 3/sdks/3.0.0/samples/badge".
In doing so I found that the new badge.fla no longer attempts to frame a supplied image with the button. I quite liked the embedded, so I just updated my older badge flash project from here, simply replacing older install.as with the newer, more robust version included in FB3B2.Feel free to steal my backwards-compatible badge.swf if you want something you can just drop in as a replacement. Also note that Adobe now recommends setting Flash 8 as the minimum flash version. Since Flash 9 has well over 90% market penetration, that's a pretty reasonable setting.
SWFObject 2.0
Geoff Stearns and Bobby van der Sluis have been busy improving their individual SWF-hosting efforts into a combined project, just released on Google code. I've updated my "Install Now" button to use the SWFObject 2.0 script, and it seems to be working well. There is a syntax change from the previous use case, but it is still pretty simple to use.Here's the new syntax:
The first two sections are unchanged. Include the swfobject.js script in a
<script type="text/javascript" src="swfobject.js"/>
<div id="dryerfox_flashcontent">
Whoa. You need to install <a href="http://www.adobe.com/go/flashplayer">Adobe Flash Player</a>.
</div>
<script type="text/javascript">
var flashvars = {
appname: "DryerFox",
appurl: "DryerFox.air",
imageurl: "dryerfox_badge.jpg",
airversion: "1.0.M5",
buttoncolor: "008811",
messagecolor: "000000"
};
swfobject.embedSWF( "badge.swf", "dryerfox_flashcontent", "217", "180", "8", "expressInstall.swf", flashvars );
</script>
<script> tag, and your app's alternate content in a <div> tag. Then use a swfobject.embedSWF() method call to replace the alternate content with your SWF and viola!DryerFox demoed at Best Buy!
Thanks for reading this far. I just thought I'd send a shout out to the techs at Best Buy (is that still Geek Squad?) for leaving their Vista demo systems wide open. On the weekend I was able to install DryerFox on a sweet HP 19" touchscreen system, and associate DryerFox with the .HTML file extension. Who sets up demo accounts with admin privileges?
Oh well, it was fun to drag the dryer around with my finger.
Tuesday, October 2, 2007
DryerFox - Maintenance mode
- Build it with Flex Builder 3 (Moxie) Beta 2
- Add in Rich Tretola's UpdateManager class
- Deploy it with the new badge installer (now called Seamless Installation)
- Wrap the Install Now badge using SWFObject 2.0
Four framework upgrades at once. What could possibly go wrong? ;-)
Stay tuned ...
Sunday, August 19, 2007
Using SWFObject and the AIR install badge for easy deployment
One of the topics I spoke on at 360|Flex was how to add an "Install Now" button to a page, using the AIR install badge from Adobe. This is very easy to do, even though this post is long-ish. Explaining what is happening takes longer than the dozen lines of JavaScript required to get this to work.
I have an example "Install Now" button for DryerFox in the blog sidebar. This button will provide a one-click install experience for your users.
Quick-n-dirty summary for adding an "Install Now" button.
Copy foo.air to your web folder. This is your app's AIR application bundle.
Create a 215 x 100 image of your app, and save it as foo_badge.jpg in your web folder.
Copy swfobject.js to your web folder. Thanks to Geoff Stearns for the fabulous SWFObject.
Copy badge.swf to your web folder.
Add the following HTML snippet to your page:
<script type="text/javascript" src="swfobject.js"></script>
<div id="foo_flashcontent">
Whoa. You need to install <a href="http://www.adobe.com/go/flashplayer">Adobe Flash Player</a>.
</div>
<script type="text/javascript">
var so = new SWFObject("badge.swf", "badge", "217", "180", "6.0.65", "#FFFFFF");
so.addVariable( "appname", "Foo" );
so.addVariable( "appurl", "foo.air" );
so.addVariable( "imageurl", "foo_badge.jpg" );
so.addVariable( "airversion", "1.0.M4" );
so.addVariable( "buttoncolor", "008811" );
so.addVariable( "messagecolor", "000000" );
so.write("foo_flashcontent");
</script>
Details - Under the hood
The SWFObject script will replace the <div> section labeled "foo_flashcontent" with the badge SWF, and populate its required Flashvars with your apps resources. Note that it is important to include some sort of fallback text in the <div> in case no Flash player is found.
| Flashvar name | Description |
|---|---|
| appname | The name of your app. This name will be displayed by the badge in various messages below the "Install Now" button. Messages like "In order to install FooApp, the AIR runtime will also be installed". |
| appurl | The URL of your app's AIR bundle. The URL can be relative to the same folder as the page, or can be an absolute URL pointing to some other domain. |
| imageurl | The URL of the 215 x 100 image (JPG/PNG) to display inside the badge. As with the app URL, this URL can be relative or absolute. |
| airversion | The version of the AIR runtime required by your app, as specified in Foo-app.xml. For Moxie beta 1, this is "1.0.M4". |
| buttoncolor | The color of the "Install Now" text in hex RRGGBB format. |
| messagecolor | The hex RRGGBB color of the message text displayed below the badge. |
Clicking the badge will do the following:
Auto-update the Flash player. The user's current Flash player version is examined and the script will update to the latest Flash Player if required. This bootstrap works as far back as Flash player 6.0.65 (released in December 2002), so that gives pretty good coverage. Will a 2002-era computer run a useful AIR app? Hmm. Probably not.
Auto-install the AIR runtime. Verify that the AIR runtime required by your app is installed, and auto-install it when missing. Each AIR app is tied to a specific runtime release, and the install badge knows how to deal with this correctly.
Auto-install your AIR app. This is, of course, what you really wanted to do in the first place.
Security Issues
Just to be clear, all of the above installation operations take place in the context of the active operating system user account. No OS security restrictions are bypassed, so the user will need admin or install privileges to succeed. This is a good thing.
Churn, Churn, Churn
The badge.swf example was added to the Flex SDK as part of the Flex 3 (Moxie) public prerelease, but that version of badge.swf was rather buggy. Adobe quickly released a patch and you will need to use the patch and avoid the one included in the SDK. I'm sure this will be fixed in the next public code drop. For now, avoid the code in INSTALLROOT/sdks/moxie/samples/badge.
Update:
Also make sure your web server is configured to know the mime-type of .air files. (*.air=application/vnd.adobe.apollo-application-installer-package+zip) More detail on the mime type is found in Mike Chamber's post here.
