adobe visit lfpug

April 2, 2007

Adobe Special – 17th April 2007

Presenters from Adobe: Mike Downey and Steve Burnard.

One not to miss!

Advertisements

LFPUG looking good yet again…

March 1, 2007

Accessibility was always one of my chief concerns back when my work was XHTML/CSS. Since moving more into ActionScript development it has I’m afraid to say slipped somewhat, relying on the usual approach of Flash site with HTML backup. Niqui’s presentation I hope will help me get back into the habit of integrating accessibility into the process and maybe get away from needing a HTML backup?

The LFPUG presentations 29th March 2007

  • A Usability Approach to Accessible Flash (19:00 – 20:00) – Niqui Merret
  • Lighten up: Rediscovering Fun ( 20:15 – 21:15 ) – Aral Balkan

keeping Flex documentation up-to-date

February 5, 2007

Just a quick post of a blog feed that should be on any Flex developer’s feed reader:

The current article lists all the locations for the official documentation. A recent posting of an update to the Data Binding documentation is IMO an essential read.


as3cb errata

January 10, 2007

Don’t get me wrong, ActionScript 3.0 CookBook is damn good, and one of the few AS3 books published to-date. However it is a first edition and does contain errata – probably due to having been written against an alpha or early beta version of Flex2 / AS3. I reported those I had found to O’Reilly some weeks ago, but at time of writing this article they have yet to be published to the errata page.

In future any significant errata I beleive I have found in any book (where the publisher has yet to make them available) I will report on this blog under the tag errata so anyone wondering why certain things don’t work, stands a chance of finding them with a Google.

1. Incorrect description of graphics.lineStyle()

This error is present throughout chapter 7. On page 182 the thickness parameter is described as having a default value of 1. Throughout chapter 7 code samples use the line:
sampleSprite.graphics.lineStyle()

I believe this line should read:
sampleSprite.graphics.lineStyle( 1 )

As from the Adobe documentation:

thickness:Number — An integer that indicates the thickness of the line in points; valid values are 0 to 255. If a number is not specified, or if the parameter is undefined, a line is not drawn.

Therefore using lineStyle as presented in as3cb will result in no line being drawn where a line of 1px thickness was intended.

2. doubleClick description

Not really errata, but the following would have benefited from one crucial extra piece of information:

Page 169, the description of doubleClick.

Generated when the user presses and releases the mouse button twice in rapid succession over the interactive display object

The above quote is true, as long as the developer has previously set the doubleClickEnabled property of the interactive display object to true. If not, no doubleClick event is fired. Considering the target audience of this book – quite an important point to mention.

3. ColorTransform

Pages 76 and 77

With regards to the ColorTransform instances, the code samples make reference to an ‘rgb’ property. No such property exists. The property the author is intending is ‘color’ which returns an rgb value represented in type uint.


tile or repeat an image into a flex application background

November 21, 2006

I’ve only been using Flex for a few weeks via the Flex Builder Beta for the Mac. While I am really impressed with the ease of use of the framework, and now something of a convert, I was suprised by the apparent inability to tile (or repeat) an image over the background of the Application.

I tried a number of approaches which I now look back on as naive. I haven’t at this point managed to find a documented solution by googling. Though as responses to this post show (update: source now published), there seems to be interest in finding a solution.

So here is one solution. I don’t claim this to be ‘best practice’. Far from it. But it works, and will suffice for me until I am more familiar with Flex.

  1. Locate your flex installation, then Flex SDK 2/frameworks/source
  2. From here navigate the package structure to mx.skins.halo
  3. Duplicate file “ApplicationBackground.as” to a suitable location within your project file structure. In my case saved to ‘{projectroot}/com/ct/skins”
  4. Edit your local copy as per the following notes

Adjust the package detail

In my case the package line now reads:

package com.ct.skins

Add some imports

We need the following import lines to access the bitmap data:

import flash.display.Bitmap;
import flash.display.BitmapData;

Remove the version include

Because we are working outside the structure of the halo skin collection, we no-longer need or want the following line:
include "../../core/Version.as";

Embed the image and declare some variables

In this case I am embedding the image at compile time:

[ Embed( source='/assets/BackgroundLines.png' ) ]
private var backgroundImageClass :Class;
private var backgroundImage :Bitmap;
private var backgroundBitmapData :BitmapData;

Modify the constructor

In our constructor, after the call to ‘super()’ we need to get the bitmap data of the image into the backgroundBitmapData variable, we do this by first creating a Bitmap instance of the embedded image in backgroundImage, then drawing the data into backgroundBitmapData:

backgroundImage = new backgroundImageClass();
backgroundBitmapData
= new BitmapData( backgroundImage.width, backgroundImage.height );
backgroundBitmapData.draw( backgroundImage );

Clear out and replace the content of updateDisplayList

The only line we need keep is the super call. Everything else can be replaced with the following 4 lines:

var g:Graphics = graphics;
g.clear();
g.beginBitmapFill( backgroundBitmapData );
g.drawRect(0,0,w,h);

Now we just need to apply it.

All we need to do is point the borderSkin attribute of the mx:Application tag to this new skin. In my case the attributes of mx:Application look like this:

xmlns:mx ="http://www.adobe.com/2006/mxml"
frameRate ="36"
layout ="absolute"
borderSkin ="com.ct.skins.ApplicationBackground"

Bob’s your uncle!

I’d appreciate comments on a better practice approach.

Further reading:


cooking on flex

November 21, 2006


Added ActionScript 3.0 Cookbook to my reading list. Not strictly anything to do with flex but it’s saved me loads of time while learning Flex and I highly recommend it.


Flexciting

October 25, 2006

It’s seemed like a longer wait than it was, but finally the Flex 2 Beta for Mac OS X is here. Posted on Adobe Labs on 23rd October.

Just in time for my next project which will be ActionScript 3 based and hopefully ready in time for Apollo. Flex seems like it will provide a better development environment than the Flash 9 Alpha.