Squiggly - Spell Checking For Flex 3

The downside to checking Adobe Labs in the morning, eastcoast morning at that, is the disconnect from the release time cycle. Anway, yesterday's release of Squiggly is one of the more interesting releases in awhile.

Squiggly is a Flex 3 spell checking component, with context menu based alternative spelling suggestions and replacement functionality, that can attach to any text component. This is particularly interesting because of the immediate utility it has for many of the projects that I have developed and/or am obliged to maintain.

Stated limitation is that the alternative spelling suggestions are based on English phonics so it is not ready for non-English dictionaries. This is not a deal breaker for my needs, but could definitely be a wet blanket for many.

Also, at first glance of the demo piece, it looks like the suggestions don't follow existing capitilization. So, if you are correcting the first word in a sentence, or a header, after making the change you will have to manually correct the case. Not a big deal, I suppose, but unfortunately this guy isn't open source so any attempts to fix it will be a little less elegant.

Anyway, limitations aside, it looks like it a really handy tool for improving the text input experience in Flex.

How do you clone a custom component/class in Flex?

I have hit a little dilemma. Can anyone enlighten me on how I could clone or duplicate a complete custom class in Flex?
I have this:


var someCustomClass:customClass = new customClass();
someCustomClass.someProperty = "someValue";
someCustomClass.addEventListener(MouseEvent.CLICK, doPageClick);
someContainer.addChild(someCustomClass);

Now, how do I do this?


var newCustomClass:customClass = someCustomClass;
someOtherContainer.addChilde(newCustomClass);
to get a clone of the first instance? ObjectUtil.copy() does not do it...

Premature Configuration: My Most Frequent Problem In Flex

(Updated on September 17, 2009)

Often times I find myself with a component whose properties I am keen to access, but that has not yet been rendered into the view. The consistent result of this effort are wonderful run-time errors, or worse, the wrong behavior without any messages. A specific example might be a situation where I have an Image added in a state, but whose source I want to update on a property change (before invoking that state):

[More]

Flex: Pitfalls Of Careless Custom Event Names

Mid-Friday quickie: Event names are important.

I am working on a project that involves a front-end controller for a series of views that all inherit from a common base class. Since I am a clever guy, which often gets me in trouble, I have a common event handler that acts as a traffic cop for all of the inherited events. This has worked surprisingly well and I have been able to add and remove inherited views with little fuss.

That said, I recently had to add a "resize" event that enabled the view to request that the flash container be resized. The background on this is that the swf is injected with height set to "100%" and an external interface call is made to a javascript that resizes the containing div (the one specified in the swfobject embedSWF statement.

I quickly threw this together and it seemed to work well enough. That is, until I put in an Alert statement for a quick view of the requested new height (I really need to start using the debugger more). That's when I noticed that every new view would generate a new Alert, even for views I hadn't touched. I verified that other events weren't randomly firing, so I quickly surmised that the problem has to be in the base class. After verifying that none of my code could be throwing my custom event, I stepped away from the problem (drink enough coffee and stepping away happens pretty frequently, actually).

Coming back, it hit me, my stupidity was obvious. The ResizeEvent.RESIZE is "resize", an event that fires when the size of a Flex component changes - which was happening with every change of the view.

So, moral of the story, when creating custom events, using something descriptive and unique. In this case, "resize" became "resizediv" and all was good.

Preventing The Browser From Returning A Cached SWF

A quick little snippet using Coldfusion to avoid swf caching at the browser. Swf caching can be a real pain in the but during the development and it can also be annoying in production. When you make updates, you actually want to view them. Anyway, enough chit chat:

swfobject.embedSWF('myFlashApplication.swf?nocache=#CreateUUID()#', 'myDiv', '600', '480', '9.0.0', 'expressInstall.swf',{},{});

So the above snippet, using swfobject because it does the trick so nicely, shows that we are throwing a url parameter at the swf to be injects. Essentially, this does nothing at all. However, the Coldfusion CreateUUID() function will give us an easy-to-generate unique number every time and the unique param. The browser sees a unique url and will grab the swf anew each time.

Hot dates for a Saturday night. - Handling Business Days In Flex

Well, sorta. Let's say that you have some known starting day and an event that happens some N days later. And, just for giggles, let's assume that every single one of those days must occur during a valid business day; no weekends, no holidays. How do we go about this in Flex?

My first version, the exact details you'll be spared because of my kind generosity, was overly complicated. This was mostly because I intended to analyze date ranges and do crazy parsing to determine by how much N had to be increased in order to account for any non-work day. I had worked out the bulk of the details but, with multiple passes, it was beginning to look like some 16th century model of the solar system.

Alex had a better suggestion. Instead of trying to look at the whole range, we do a single forward loop, adding each of the N offset days individually, testing as we go. The devil is in the details, of course, but I've broken it down into 6 handy little functions. For my purposes, making a class of static methods seemed pretty reasonable as I wanted to be able to reuse these utilities at will and I didn't see the point instantiation. The methods will be:

[More]

Addons to Flex Single File Uploader

Not to make too much of a habit of it, but here is another post that features minor, though in many cases needful, changes to handy example components. In this case, the target is a single file upload component. You can get a pretty decent base component in a package of actionscript 3 samples from Adobe.

Contained in this handy zip of samples is the FileIO folder. We can get single file uploading up and going rather quickly by using the com.example.programmingas3.fileio.FileUpload (FileUpload.as). The base code looks like this:

[More]

Addons to eComboBox - Flex ComboBox selectedValue & More

A common requirement in the wonderful world of Flex is a combobox that enables us to set the selected state by value, instead of by the target's ordinal position. I'm sure that there are many implementations that are just a google search away, but the one that many of us have found was helpfully provided by Ben Forta. His implementation of a Flex combobox with selectedValue support is a good beginning and, in many cases, the end-all-be-all of what one might need.

However, there are those times when you need a little something extra. In particular, I found myself needing to the following:

  1. Using the standard ListEvent.CHANGE event to react to changes caused by setting the selectedValue
  2. Specifying the target property of the dataProvider on which selectedValue is compared.
  3. Using an XML dataProvider

So, taking a look at the original code from Ben:

[More]

Adobe Air HTML with Hotmail & Gmail

I finally managed to steal a bit of time to work on a small little intro project for Air. I have already made a couple of little apps, but I somehow didn't feel complete because I hadn't spun my own Air-based browser ... I think it might qualify as the "Hello World" for Air.

Anyway, having taken the 2 minutes needs to create a project, throw the HTML, TextInput and Button needed, I had a little browser going. Of course I started with Google because I live my life as a cliche, but I decided to see how well it worked with web based mail. I particularly remember having issues with Hotmail and Chrome when it first came out, but those seemed to have gone away - so how would my Air application behave?

[More]

Adobe Developer Day - Romania

It's good to see once in a while some positive news come out of my native country, Romania.

I am proud to say that the Romanian Adobe presence is doing well, and I wish them the best.

On that note, details about the Adobe Developer Day event in Bucharest, May 19, from Mihai Corlan, Adobe evangelist for Romania.

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.001. Contact Blog Owner