Flash On

Flex 3: Anti-aliasing on buttons, tabs & other labels

17-08-2009

antialiased

Over on the Adobe live docs page on embedding fonts and anti-aliasing there is plenty of help on how to go about getting elements looking good.

Firstly, is it really necessary to embed standard web fonts to do anti-aliasing? Seems a bit overkill, since 99.9% of users must have these fonts…thats why they are standard web fonts. It increases the size of each application and creates more work/processing. Lets just have an option to make text anti-aliased and be done with it.

Secondly, is it just me or do the examples on the Adobe page clearly show buttons with dreadfully pixelated text. Sure, the labels looks good. But try making the text of a button, or a tab or a progress bar label anti-aliased. It just doesn’t work. This is fine for applications that do not use any of these items. But for everything else, it seems like a bit of an irritating gap.

I ended up using images or simple labels to get round this.

Written By Tim for the Web Technology section Tags: , , , ,

Flex 3: Messages between multiple browsers and AIR

17-08-2009

copy

Sending messages from the browser and AIR using the Flex localConnection class is fairly well documented. I recently needed to extend this to support multiple instances of the same browser flex application talking to a single AIR app. (Cheers to Dave for this trick!)

To do this I assigned each browser instance a random ID, which is sent across in the arguments of a standard AIR launch call…

_air.launchApplication(appID, pubID, currentlyConnectedSwf);

or on install of the application

_air.installApplication(appURL, runtimeVersion, currentlyConnectedSwf);

Over in the AIR application I then return the message from the AIR app targeting the specific browser instance using the ID collected by the browserInvoke method….

outGoingConn.send(”www.imbimp.com” + “:” + currentlyConnectedSwf, “localConnectionHandler”, ‘AIR to SWF’);

Written By Tim for the Web Technology section Tags: , , ,

Flex 3: Detecting hard disk space

17-08-2009

v9_install_error2

Flex does not appear to have a library that deals very well running out of disk space, and this was a key part of the recent work I did on a download manager. When downloading files using the URLStream method and saving to disk with a fileStream, if you run out of space, either on your main hard disk or perhaps a USB flash drive you will get a runtime IO error, #3003.

This is handled easily enough with an event listener…

stream.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

But also ensure this is followed up with a check for the error code, since the same ioError will be fired if network connection goes down unexpectedly.

Written By Tim for the Web Technology section Tags: , , ,

Passing XML to AIR app via a Browser

24-06-2009

In my recent efforts to create an MP3 downloader application I have been extensively investigating the Adobe Flex browser API to pass through download URLs and other meta data through to my app.

Any sensible person would ensure a web service or suitable server-based XML file was available to AIR requiring only an ID or two to get going but in this instance I had no such luxury.

Typically a flash/flex badge sits on a website and can detect, install and launch an AIR app while passing through simple arguments. It is not widely documented that these arguments may only be alpha-numeric and may not include special characters like dots, slashes, percents and ampersands. This counts simple encoding out.

The way the flash badge fetches content from the page is using the External Interface method whereby the flash badge can call JavaScript functions embedded on the page, which in turn allows XML, also embedded in the page, to be collected and encoded.

I came up with my own encoding mechanism so that XML could be passed through the flash badge and into my AIR app as a string and then decoded there. This meant replacing . with DOT and % with PCNT and / with SLSH etc etc

So everything is working a lot better now, although it would be helpful if Adobe included details about this restriction in their Flex documentation to save wasting time debugging why the flash badge fails to launch the AIR app for no apparent reason. It’s probably a fair restriction for various security reasons due to people running dubious scripts on even more dubious websites that would somehow take hold of your computer via AIR. I had never thought a percent sign could be so dangerous, exclamation marks are much more scary.

Written By Tim for the Web Technology section Tags: , , , ,

London Run on Bikes

22-06-2009


Westminster, originally uploaded by Tim Tim Tim.

Saturday night saw us embark on the first London Run for a number of years. The basic premise behind a London run is to navigate around London’s various sights throughout the night, thus avoiding the crowds and using as much petrol as possible, then saving petrol on the return journey by cruising round the M25 at 56mph. The car journey usually passes through Heathrow, all the key sights in central London and finishing at a round about North of the Thames in view of the Millennium Dome.
Read more…

Written By Tim for the Stuff section Tags:

Adobe AIR Downloader app

22-06-2009

My Adobe AIR Download Manager
Since designing and estimating the work on this downloader app, the time has come to actually build the thing.

The first thing to overcome was using the built-in components to facilitate a download. Searching for assistance on this was made particularly tricky given that my previous article seemed to keep appearing in Google despite providing no actual help.

Huge thanks go out to Elad and his flex download api. This helped me get going enormously. To start with it only supported single downloads, and although I could queue these up, I wanted to be able to support concurrent downloads.
Read more…

Written By Tim for the Web Technology section Tags: ,