lfpug again 22nd Feb

Looks again like two good presentations tonight at the LFPUG in London…

  • Smoke, Fire and Water – Creating Realistic Procedural Bitmap Effects (19:00 – 20:00) – Alias Cummins
  •  Apollo: The unofficial WTF ( 20:15 – 21:15 ) – Dan Thomas

Unfortunately work commitments are going to keep me away, but I’ll have my fingers crossed that the live feed will be in operation, and I will be snooping in.

Posted by creacog in Apollo, Flash Platform, Flex, 0 comments

Flex Builder 2 UK Pricing – Groan

For a company that is so good technically and creatively, I am dissapointed by Adobe’s pricing policy to customers in the UK. I don’t necessarily expect the UK price to be set directly relative to the US price, but the UK mark-up seems to me to be excessive. I think the following facts speak for them selves (Flex Builder 2 with Charting)…

  • Before tax, UK price is US price +29%
  • US online store price $749 before tax
  • Current $:£ = 1.9744 translates this price to equivalent of £379.36
  • UK online store price £489 before VAT
  • Therefore a pre-tax Markup of £109.64 or 29%.
  • Equivalent US Price would be $965.48

The explanation:

The price of software in EMEA (Europe, middle East and Africa) reflects both the additional expense to develop and test Adobe’s applications for local markets and operating systems, as well as for the delivery of complimentary Warranty support.

On top of the base price, EU customers have to pay VAT. Most businesses can claim this back, but smaller companies and individuals cannot. The VAT rate in the UK is 17.5%, and there is this little gem for UK customers of the UK online store…

The store indicates VAT inclusive prices for the shipped boxed product at £574.58, and the download actually more expensive at £591.69.

The explanation:

Since our server is based in the Republic of Ireland where VAT is charged at 21% our downloads are more expensive than boxed goods which are shipped locally from the UK

Priceless!

Back to the main issue of pricing outside the US, of-course I am not the only one to notice this, and Adobe are not the only company to operate this way as the articles published here describe…

Posted by creacog in Flex, 5 comments

as3cb errata

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.

Posted by creacog in ActionScript, Flash Platform, Flex, 4 comments

a shakey first few moments with 2.0.1

I had a scary first experience with the Flex Builder 2 (2.0.1) Trial on the Mac, after having commenced a project using the Beta…

Before installing, I was aware of the following bullet in the release notes

Opening old Flex projects – The Flex Builder 2.0.1 update cannot open projects that were created with pre-release versions of Flex Builder 2. Flex Builder 2 beta-level projects must be recreated in Flex Builder 2.0.1.

So I zipped a back-up copy of my project files.

On installing and launching 2.0.1, I was suprised that my existing projects seemed to open ok. But ‘cleaning’ the project had the effect of removing the html files. Additionally seemingly spurious errors were generated on compile. The first being 1023: Incompatible override.

I keep my project files on a seperate disc away from the default location. So I deleted the folder and restored just my source files from a zip and recreated the project in builder 2.0.1 – still no joy. In-fact even creating a new application project with only the default stub resulted in errors reported at lines which didn’t exist. (Similar to these reported issues on Flexcoders).

I found the issue to be primarily that the 2.0.1 Builder looks for the same workspace files as the Beta – and they aren’t compatible. The solution…

Rename the existing “Flex Builder 2” folder to “Flex Builder 2 Beta” to accurately reflect the builder that created it. (Just to ensure you can revert to using the Beta if you need to – which I thought would be a likely prospect if my experiment failed) On the Mac:

/Users/username/Documents/Flex Builder 2
becomes
/Users/username/Documents/Flex Builder 2 Beta

(Note: for Flex Builder 2 Beta to pick up it’s workspace again, you need to choose “File>Switch workspace…” from the menu. Not that you’ll want to go back to the beta, once you have 2.0.1 running properly.)

Then when launching the 2.0.1 version, the “Flex Builder 2” folder will be re-created but this time containing a 2.0.1 compatible workspace. You can then start creating projects, porting your old source files as you see fit.

All the spurious errors are now cleared, and proper html files created. So far looking good with improved performance over the beta!

Posted by creacog in Eclipse, Flex, Mac OS, 0 comments

New flex dot-one, one day away

In case you missed it we have a new Flex dot release (2.0.1) due in the next 24 hours. Very significant for us Mac users – time to get the full version and pay for it!

I was hoping that there might be a simultaneous Apollo release. But while this version introduces development support for Apollo, the beta version seems to have a way to go yet.

More detail of the new features here.

Anyway, “Ted On Flex” seems excited! (A blog worth signing-up to if you are interested in Flex)

Posted by creacog in Apollo, Flex, Mac OS, 0 comments

tile or repeat an image into a flex application background

UPDATE: There is a revised version of this post here, which you might find more accessible. It also includes a tile into the background of a Canvas.

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:

Posted by creacog in ActionScript, Flex, Flex 2, 10 comments

cooking on flex


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.

Posted by creacog in ActionScript, Flash Platform, Flex, 0 comments

Flexciting

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.

Posted by creacog in ActionScript, Flex, Mac OS, 0 comments