March 21st, 2007
Here is a nice little example of testing for online and offline within Apollo. It is very basic.
Test it by either hitting the Test Connection button or by pulling your cable on disconnecting your wireless.
Here is what is occurring within the application:
- on creationComplete Shell.shell.addEventListener(Event.NETWORK_CHANGE,onNetworkChange);
- onNetworkChange test the connection. Here is the contents of the test connection function.
-
var headRequest:URLRequest = new URLRequest();
headRequest.method = "HEAD";
headRequest.url = "http://blog.everythingflex.com";
var response:URLLoader = new URLLoader(headRequest);
response.addEventListener(HTTPStatusEvent.HTTP_STATUS,statusChanged);
response.addEventListener(IOErrorEvent.IO_ERROR,error);
- when the HTTPStatusEvent.HTTP_STATUS Event is broadcast statusChanged is called
- The statusChanged fuction checks the status code and sets disconnected if code is 0
- if IOErrorEvent.IO_ERROR is broadcast
- we assume the connection is broken
Thats it. There are additional URLLoader events that can be checked but I haven’t included them in this example. Check the documentation for details on these events. Here is the results:
ONLINE:

OFFLINE:

Download the application
Download source code
7 Comments |
Adobe AIR (Apollo), Tutorials |
Permalink
Posted by everythingflex
March 21st, 2007

As promised, here is the code from last nights presentation.
Download it here
No Comments » |
Flex 2, IndyFlex, Tutorials |
Permalink
Posted by everythingflex
March 21st, 2007
LiveCycle Data Services 2.5 is the next generation of the Data Services product originally branded Flex Data Services as a part of the Flex 2 launch.
Here is the list of new features:
- A new Flex SDK (which will be released currently with Data Services 2.5), which includes updates the client-side Web Services library.
- Server-side PDF generation capabilities for RIA applications generates properly formatted PDF documents that include graphical assets from Flex applications, such as graphs and charts.
- Runtime configuration of data destinations in Data Services eliminates the need for a compile-time dependency between clients and the Data Services server configuration.
- Support for WSRP portal deployment of Flex applications, which makes it easy for developers to deploy a Flex application as a portlet in a portal server without having to do any portal specific programming.
- Per Client Messaging quality of service (QoS) allowing Flex clients to select custom data access policies for real- time data.
- Ajax Data Services, enabling Ajax applications to take advantage of the data management and messaging capabilities available in Data Services.
- The Flex-Ajax Bridge (FABridge), which is a small library that can be inserted into a Flex application, a Flex component, or even an empty SWF file to expose it to scripting in the browser without any additional coding.
- Improved off-line message queuing, supporting future Apollo development, which allows Flex applications using Data Services to queue outbound messages locally when the client is offline and manage exactly what is sent to the server upon reconnect.
- Groundwork for future Apollo application support, including a local data cache that enables developers to cache client data requests and data changes to the local file system for later retrieval when an application resumes.
- RTMP tunneling (RTMPT) that allows the use of the RTMP protocol in Data Service applications to traverse firewalls and proxies that currently prevent direct RTMP client connections to the server.
- A new SQL adaptor, which dramatically simplifies the development of applications using Data Management Services without having to write any server-side Java code.
- A new JSP Tag Library that enables MXML and ActionScript code to be embedded into a JSP page providing an easier entry for J2EE developers to Flex programming.
- Several important enhancements to core Data Services performance and scalability.
It is available on the Adobe Labs site now.
No Comments » |
Announcements, Flex |
Permalink
Posted by everythingflex
March 20th, 2007
OK, last warning. Tonight is the Indy Flex user group meeting.
Please join me at the Indianapolis Flex User Group on Tuesday March 20th, 6:30 PM
Location:
LANTech Training
The Pyramids,
3500 DePauw Blvd.
Pyramid 3, Floor 2
Indianapolis, IN 46268
P.S.: If there is time, maybe I can show off some Apollo stuff.
No Comments » |
Announcements, IndyFlex |
Permalink
Posted by everythingflex
March 20th, 2007
One of the beauties of Apollo is the ability of the application to update itself whenever necessary. Those of us who are used to the client/server metaphor have never had to worry about this because if we found a bug in our code (yeah right), we could simply update the server and it is like it never even happened. However, now that we are offering our applications for download, we lose a certain piece of control. Unless, we build in a method for our applications to update themselves when necessary.
This example shows one method for doing this. Here is how it works.
- I set a variable to hold the current version number (It would be nice if we could simply read the version number from the -app.xml file but I don’t see a way to easily do this with the current alpha)
- I have setup an xml file on my server to store the latest version number and file name which is called via HTTPService. Here is what the XML file looks like:
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<latestVersion>.4</latestVersion>
<latestFileName>SelfUpdating04.air</latestFileName>
- After calling the HTTPService, I compare the currentVersion to the latestVersion and Alert the user.
- If the user asks for the update I retrieve it via the URLSteam, which then calls methods to write the AIR file to disk.
- Finally, I call the Updater update method which installs the new version and restarts the application.
Here are some screen shots and links to download the outdated version of the application and source code.
Version .3 loads:

User clicks “Check for Update”

After choosing “Yes” new version downloads and installs (Wow what an upgrade!!)

Finally, the user clicks “Check for Updates” again

NOTE: Please do not run this over and over again or you will suck up all of my bandwidth. You can easily replicate this on your own servers.
Also, this application puts the control in the users hands, but you can also do all of this automatically by checking the version on creationComplete and then installing the new version automatically without user interaction.
Download the Application
Download the Source Code
17 Comments |
Adobe AIR (Apollo), Tutorials |
Permalink
Posted by everythingflex