Skip to content

Archive

Tag: Adobe Air

I have been a little quiet lately, and when I have blogged it has been rather short posts. That is largely due to the fact that I have had a big deadline looming, which is now over.

KnowledgeTree released the commercial edition of KnowledgeTree 3.7, which makes some significant changes over the previous version.

For one thing, it is considerably faster, which is one of the biggest complaints customers had previously.

Now, before I lose any of you, KnowledgeTree is a document management server, which allows you to maintain a repository of documents in a central location. Think along the lines of Al Fresco or Sharepoint if you are still lost.

By far (for me anyway), the most exciting thing to ship with this is the new client tools. I have a vested interest here, as I am on the team which works on the client tools.

The new kid on the block for the client toools is KnowledgeTree Explorer CP, which is an explorer application which allows you to browse and manipulate files on a KnowledgeTree server off your desktop.

KnowledgeTree Explorer CP was written using Adobe Air, and works on Windows, Mac OS X and Linux. The bulk of the code is Javascript based, and some of the things we were making Adobe air do simply has not been done before.

Many hours of my life has been spent on Explorer CP, and it is a great feeling to finally see it released to the world.

Go download an evaluation copy of KnowledgeTree 3.7 Commercial Edition, or, if you would like the free edition, go look at KnowledgeTree 3.7 Community Edition
Here is to the best release of KnowledgeTree yet….

  • Share/Bookmark

Ah, the sheer programming bliss. I have been eagerly awaiting getting my hands on Adobe Air 2.0.

It has included a host of features that will make my life so much easier. It boasts a faster Webkit engine, making Javascript-based libraries run much faster. Improved network functionality, and the file promise API are other delectable additions.

Included in both Flash Player 10.1 and Adobe Air 2.0 is support for touch-screen monitors and support for the inbuilt mic so sound recording is now possible too.

Still have to wait for the mobile version of Flash Player 10.1 though…hopefully for not too much longer.

  • Share/Bookmark

I saw this morning on Inside RIA that Adobe Air 2.0 will be released in the first quarter of 2010. The beta should be out before the end of the year.

This is very exciting news for me and my colleagues at work, since the application we are developing is based on Adobe Air.

It has a substantial amount of new features, and will be based on Flash player 10 using Flex 4.

Amongst the new features is support for IPv6 networking, UDP support, a DNS resolver to find out DNS information.

The biggest new feature for us though is the file promises API, which will enable you to drag and drop remote files seemlessly and easily, using URL streaming. Currently, Adobe Air only supports drag and drop on real local files.

The application will also have better performance, both in memory and CPU resources, which will make the applications run much better.

If you want to find out more about the new features offered in Adobe Air 2.0, click here.

  • Share/Bookmark

If there is one thing that can drive me insane is the way in which Javascript handles errors.

The way Javascript does this is dependant, to a degree, on the browser implementation, but the worst offender for me occurs in Adobe Air ( and quite likely some other browsers too).

Let’s first introduce the scenario. Imagine a large framework built up with several Javascript ‘classes’, with multiple functions in each class.

Now, creating an instance of the class, and using the object, one of the functions generates an error when you call the function. Let’s assume the reason for the error was intermittent, caused by an improperly set parameter. What I mean is, that the function in question should not consistently fail, but only failed in that one instance.

The problem comes in that Javascript then decides that, since the function failed, then there is a problem with it, and consequently refuses to execute that function again after it has failed.

In a real world example, I had a function that starts a file download. It would work fine, until it crashed trying to download a file that does not exist, and after that, every call to that function would fail until I restarted the application. It is a problem that can cause some severe debugging headaches unless you are aware of this behaviour.

The solution to this problem is to use try-catch blocks around code that is likely to fail in this way, so that the code fails gracefully, which should be how you are coding anyway.

  • Share/Bookmark

In a previous post, I talked about how Adobe Air was swallowing up the Javascript keydown event for the ctrl+v key combination. Now I have figured out a way to bypass the key events altogether and tap directly into the copy, cut and past events.

These events get triggered whenever a copy, cut or paste occurs, and is consistently triggered within Adobe Air (and any other browser for that matter).

Now, the element on the page I wanted to attach the event to has an element within it that gets dynamically generated, and no amount of tweaking would get the dynamic content to trigger these events within Adobe Air. In Firefox, it did all work as expected.

So my solution for this slight problem, is add the copy/cut/paste event listeners to the window (which would always trigger – dynamic or not) and then add listeners for the focus and blur events on the element I want the editing events trigger for.

There is one more hack needed though. Adobe Air, for some unexplained reason was firing the copy/cut/paste events twice each time I triggered it, so I put in a flag which checkes if the same event is refiring and ignore it.

So the code below, will give selective copy/cut/paste functionality in Adobe Air with no hassles.

var eventHandled = false;
var elementSelected = false;

pasteHandler = function(e) {
	if (eventHandled == false) {
		if (elementSelected == true) {
			alert('Paste');
		}
	}
	eventHandled = !eventHandled;
}

copyHandler = function(e) {
	if (eventHandled == false) {
		if (elementSelected == true) {
			alert('Copy');
		}
	}
	eventHandled = !eventHandled;
}

cutHandler = function(e) {
	if (eventHandled == false) {
		if (elementSelected == true) {
			alert('Cut');
		}
	}
	eventHandled = !eventHandled;
}

elementFocusHandler = function(e) {
	elementSelected = true;
}

elementBlurHandler = function(e) {
	elementSelected = false;
}

document.getElementById('myelement').addEventListener('focus', elementFocusHandler, true);
document.getElementById('myelement').addEventListener('blur', elementBlurHandler, true);
window.addEventListener('paste', pasteHandler, false);
window.addEventListener('copy', copyHandler, false);
window.addEventListener('cut', cutHandler, false);
  • Share/Bookmark


I love the For Dummies series of books, and this one is no exception. It contains enough details about Air to get you going and using it quickly and easily. In the tradition of the For Dummies books, it addresses Air in a very easy to understand way.

It points out a lot of gotchas and pitfalls to watch out for when using Air too, which is most useful when first encountering the system or porting code across from a web environment.

This book will also help the novice, given the straightforwardness of the writing, although a seasoned veteran may need something more to keep him happy.

  • Share/Bookmark


Adobe Air can be very finicky when it comes to ajax, as it has quite a lot of security rules to protect your computer from rogue scripts, and that is where this book comes in handy.

Most of the book covers general topics in Adobe Air, giving Air a full treatment, but where this book stands out is detailing how to get ajax working withing the Air environment, bypassing the security restrictions. For example, there is a chapter dealing with a client/server bridge.

Another great feature of this book is that it focuses on using Javascript to build Air applications rather than Flex, which is great for all us Javascript developers.

This book makes a good reference.

  • Share/Bookmark