Error 1069 with item renderers/editors

Just in case you happen to be working with a DataGrid and itemRenderers / itemEditors, as you test (in my case a CheckBox was used as an itemRenderers / itemEditors), you might see the error below get thrown:

ReferenceError: Error #1069: Property null not found on [some class] and there is no default value.
at mx.controls::AdvancedDataGridBaseEx/itemEditorItemEditEndHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.controls::AdvancedDataGridBaseEx/endEdit()
at mx.controls::AdvancedDataGridBaseEx/deactivateHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.controls::AdvancedDataGridBaseEx/endEdit()
at mx.controls::AdvancedDataGridBaseEx/mouseDownHandler()
at mx.controls::AdvancedDataGrid/mouseDownHandler()

The mistake I made was dumb, I basically forgot to specify the dataField and editorDataField properties on the DataGridColumn. So make sure you specify those values when working with itemRenderers / itemEditors!


Participate in Flex Survey

Here is your chance to help improve Flex, go take the following survery.


Anyone know how to display currency symbols?

Anyone know how to display currency symbols in Flex (for euro, pound, yen, etc...)? Without the use of icons?Any help is greatly appreciated.


ChromeOS could be game changer

Just got home and was reading the news today about Google's ChromeOS. And after seeing a couple of videos of what this OS is going to be about, I think this can be a game changer. Think about it, every day we spend most of our time doing something on the web: email, chatting, social networking, buying, selling, research, studying, etc... Now granted, being a developer, my work is done all on the local machine, thus on the local OS, but that's true for a very small portion of the population. For the vast majority of people using a computer, all the actions mentioned previously are done on the internet via a web browser. The only thing they need the local computer for is to store pictures and music.

What Google is doing with the ChromeOS is making using a computer simpler and thus more accessible to people who still don't want to use a computer, or simply find one hard to use. Recently I've had a friend get a MacBook and an iPhone, one of the first things she mentioned is how easy it was to setup everything she uses on a daily basis for her professional and personal life. If people can eventually say that about a computer running ChromeOS, then Google has won. Ever hear anyone say that about Windows? hmmm. It has become easier yes (especially with Windows 7), but it is still not as simple.

Another good thing about ChromeOS is that it is basically a browser frontend. So that means more Flex and AIR applications will be able to reach the masses. So one unified platform to create applications that can run of various devices (netbook, mobile, PCs)...one step closer to utopia :)


Adobe Flash news from MAX

Although I am not there this year, I did have a chance to follow the Adobe MAX Day 1 Keynote today and there is some great news that was announced. In no particuliar order:
  • Flash Player 10.1 will run on all devices, yup that includes smartphones, no need for FlashLite anymore.
  • Flash Player 10.1 reduced application footprint by 50% in some cases (like DataGrids)...important for running on smartphones.
  • Flash Player 10.1 will run on BlackBerry, Palm Pre and...and...iPhone, cool! (sample Flash iPhone source code here)
  • Flash Catalyst beta 2 has been released (more info here)
  • AIR 2.0 is going to have some killer features: microphone integration, touchscreen, launch native applications and more
  • LiveCycle Enterprise new features related to some points above... details here and here.
Can't wait for tomorrow's keynote :)

Administering SQLite for AIR projects

During AIR development I have found that using SQLite Administrator is pretty good. Allows me to easily create/update table structures, run queries and edit data.

Error #3132 in AIR and SQLite Data Types

I was working on an AIR project which makes use of the embedded SQLite database this week and ran into the following error:

Error #3132: Data Type Mismatch.

At first I thought no big deal, I am doing something wrong at the coding level. The code in question was doing an insert on a table and so I thought I was passing the wrong data to the database, but at first glance, I could not see anything wrong. Then I started by removing parts of the columns I was inserting into in order to figure out which one was the problem and I still couldn't figure it out. After some googling and confusion I remembered I changed the data type (from Boolean to Text) on a column on that exact table. So what I did was to drop (delete) the table and re-create it from scratch and voila, problem solved.

So the error was correct, but didn't occur because the data I was passing was incorrect, but because SQLite still thought the data type of the column was a Boolean. Deleting and re-creating the table was the solution.

That brings me to point and wondering if I can get some feedback, I have seen that working Boolean and Timestamp data types in SQLite and AS3 is not working as fluently as it should be, so I use Text and Numeric for each respectively (at the DB level that is). Specifically for date information, I simply do a Date.getTime() in AS3 to get the number of milliseconds since 1970-01-01 and store that, seems to work for me. Anyone else have these problems?


Additional Flex 3 charting components

I've recently been working on re-building our reporting UI for our customers at work using Flex, Spring and iBatis. I've had lots of fun doing it and have got it done in a pretty short amount of time. This has given me the opportunity to add some pre-defined charts to the application that display the data in a more visual manner. This was also quick to implement because of how easy it is to use the various charting components (Pie, column, bar, etc...) that come with Flex.

My boss however, wanted me to look into something advanced regarding charting and I saw that it was not possible with the out-of-the-box charts that Flex provided. So I started to google for alternatives and found that some people have created additional charting components that are really great. I have included a couple of them here:

Funny thing as well this week I attended an online demo of BIRT, which actually uses Flex to draw it's charts. So take a look at the links above and enjoy :)

Comparing various RIA technologies

Just viewed this presentation from one of the guys from parleys.com about his comparison of various RIA technologies. Basically he talks about how they went about choosing Flex to create the parleys.com website and then demonstrates the same website done with GWT and JavaFX all the while pointing out the pros and cons of each technology. Very well done.


DisableIcon for Buttons

Assigning an icon to a button is a fairly trivial task in Flex. It is so easy in fact that I use it quite often. At the same time buttons often will become disabled depending on the state of the application and this then leads to a problem. Although the button will not respond to user interaction, the icon on the button itself will still appear the same, thus the user might think that the button is enabled when it fact it is not.

In order to resolve this you must use the disabledIcon style of the button to specify a "greyed-out" version of your icon that will be displayed when the button is disabled (refer to Flex API). Then the question arises how do you get a "greyed-out" look of your icon to use on your button? What I did was use Fireworks to set the saturation level of the original icon to -100. I did so by going into the following menu:

Filters > Adjust Color > Hue/Saturation

You will get a window that will pop open and allow you to change the Saturation level to -100. Then save the icon with a new name and use it in your Flex application as so:



Using SharedObject across SWFs

At work we have a web application that is comprised of various SWF files written using Flex 3. Just this past week I was trying to share some data amongst two of those SWFs and was wondering why SWF B could not read the ShareObject created by SWF A.

See normally to read/create a SharedObject you write code like this:

var so:SharedObject = SharedObject.getLocal( "mySO" );

The above line of code will read the SharedObject called mySO or create one if it does not already exist in a similar folder structure as the one that follows (varies based on OS - I am using Vista):

C:\Users\Jimmy\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\blabla\localhost\SWFA\mySO.sol

Since the SharedObject is created in a folder specific to SWF A (see the "\localhost\SWFA" above), SWF B, will not be able to read this SharedObject, thus the both applications cannot share data between eachother.

In order to solve this, you must specify an additional parameter to the getLocal() method call to tell it to save the SharedObject in a folder location accessible by both applications. An example is:

var so:SharedObject = SharedObject.getLocal( "mySO", "/" );

What this will do now is create the SharedObject in the following folder structure:

C:\Users\Jimmy\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\blabla\localhost\mySO.sol

Hope this is helpful to some when working with SharedObjects. It is a simple, yet primitive way to share data amongst two Flex applications without requiring the use of a server of any kind.


Livecycle Data Services 3 preview

With Flex 4 and its great new features in the pipe, Adobe is also working on the next version of Livecycle Data Services (LCDS) (version 3). If you know a little about of Flash Builder 4, there are new features in there to help with model driven development. Well with the new LCDS extensions for Flash Builder 4, you can take this even a step further (codenamed: fiber).

Basically what you can do is define you model, connect it to your favorite database and then generate an interface to interact with the data. Basically I see it as tools to create/update small applications quickly or to perform rapid prototyping for larger enterprise class applications. Flash Builder in combination with LCDS 3 can really do alot for you by generating the database structure from your model definition and then will also generate an interface with the basic c.r.u.d. operations ready to go. It will also do things like allow you to easily apply field validation to your model. Sort of reminds me of my good old days working in VB!

To actually see some of this in action, go here.


FlexCommon 1.1 released

I have just uploaded version 1.1 of my Flexcommon library. This release contains a simple bug fix to the RFCEmailValidator class and also adds a new validator: the AdvancedCreditCardValidator class.

The AdvancedCreditCardValidator class is actually a partial re-write of the CreditCardValidator class that comes with Flex. It validates more card brands than the included validator and does so by using regular expressions that are found inside a resource bundle.

Hope you enjoy this release, any feedback is appreciated.

Looking for Flex developer in Montreal or Ottawa/Gatineau

My company is currently looking for a Flex developer like myself to add to the team. So if you are in the Montreal or the Ottawa/Gatineau area (we have offices there too), please send me an email with your resume to: jimmyg1975@gmail.com

We are basically looking for someone with the following skillset/qualities:
  • Flex 2 or higher
  • AIR is a nice to have
  • Java (thats our server-side technology)
  • BlazeDS / LiveCycle
  • Creative
  • Keeps up-to-date with the Flex community
  • Keeps up-to-date with recent technological advancements (likes to dabble)


Alertbox, nice web site

Reading the 37signals.com blog today as I do everyday, they mentioned an interesting web site called Alertbox. It basically contains some articles regarding web design and usability which is well done. I have read a couple articles already and I would recommend it to everyone who is interested in such things.

Careful using rowIndex in an itemrenderer

The original title of this blog post was different to begin, but as I was coding I discovered that what I thought was going to be a great tip to share, was in fact not. You see I was trying to do some specialized display in an itemRendererer (in a DataGrid) but was not able to do it. As-is, each row in a particuliar column was displaying an amount, but the requirement came to me to display an amount range based on the value in the next row. For example, say the first row of data was displaying 2.00, and the amount value in the next row was 5.00...the first row should then display 2.00 - 4.99.

I was thinking I could accomplish this by using an itemRenderer and making use of the this.listData.rowIndex property to allow me to "know" the current index in the ArrayCollection, to therefore be able to get the data from the next row, if available. However the rowIndex property gives you the index of the current row being display by the itemRenderer, not the index in the ArrayCollection. Thus my idea backfired.

The reason is, the this.listData.rowIndex property returns the index of the current row being displayed, not the current index of the ArrayCollection as it is being traversed. So if your DataGrid (or any list control for that matter) is only displaying 4 rows, then the rowIndex property will only have values that go from 0 to 3; but your ArrayCollection might have X items in it, so its index will go from 0 to X - 1. And as the user scrolls the list control, although the rowIndex property will always have a range of 0 to 3, the current items from the ArrayCollection that are being displayed, might be items that have index of 14 to 17.

I still don't know how to resolve this issue, if anyone has any ideas, please let me know.

ebuddy.com should run on AIR

I have a couple of friends that use ebuddy.com as their IM client at work to stay in touch with friends. I just tried it today and it is a cute little application that is also very useful if you have firewall issues at work that prevent you from using the regular desktop clients. Of course, using this application for a short while I was thinking that this would make a great AIR application.

The advantages would be that would get toaster notifications, use desktop drag'n'drop to share images/files, custom chrome and no browser related issues. This is a perfect example for the AIR use-case, so hopefully they will come around and do it someday.


Buzy week for Adobe Labs

The first week of June has been a buzy one for the Adobe Labs web site, where several new applications have been posted. First and foremost is the beta release of two important development with regards to the Flex community, Flash Builder 4 and Flash Catalyst 1. Yes you read that right, with the next release, Flex Builder has been renamed Flash Builder so that it fits properly under the Flash Platform umbrella. I also believe that the renaming is also a good idea, because too many times in the past people got confused about the cost of Flex, or shall I say Flex Builder. See now you can clearly distinguish between the two and say, the Flex SDK is 100% free and open source, whereas the development tool called Flash Builder is not, it costs XX dollars to purchase for use.

Also the first build of Flash Catalyst is available, which is the tool built for designers. Meaning a designer can create the look-and-feel of an application and then pass it on to a developer who will use Flash Builder to add the business functionality and complete the application.

Another cool thing announced this week is the BrowserLab, a web-based tool that you use to preview a web site you are developing on different browser and OSes, so you can tweak your web site to look the same across the board. The are limited spaces however to try this tool out, so better sign up now if interested.

Last, but not least, Status was announced, a framework that allows you to built Flex applications that can incorporate peer-to-peer communications between two Flash Player instances at run-time. I remember seeing this at MAX last year and thought this was one of the cooler demos that were shown. Think of chat application with the server basically.

So like a said, a buzy week indeed :)


FlexCommon 1.0 library launched

Well my first ever venture into open source has happened. I have created a Flex library called FlexCommon on the GoogleCode web site. This library contains some utility classes and validators which I have been using at work lately and that I wanted to share with the Flex community. It is not much to start, but hopefully I will be adding some more as the months go by and hopefully it will be useful to some of you.

Any feedback is welcomed, but for now, just go download it and use it!


Flex Single Sign On Example (SSO)

I already provided a Single Sign On example using Flex and BlazeDS last year as a download but now I have put it up on Google Code along with the rest of my examples. In order to access the example go to this site: http://code.google.com/p/jimmycode/. It runs on Apache Tomcat and you should be able to check it out and make it run with just a few clicks of the mouse.

Enjoy and if there are any questions, please don't hesitate to ask.


FlashCamp sample code

Thanks to all for coming out this past Thursday to the first ever Montreal FlashCamp! It was a great success with a full crowd on hand to take in all the various sessions.

I had particuliar fun giving my Flex 101 session and actually was a given a little extra time to make sure I got everything in. It was great fun and got some good feedback, so hopefully I will be able to do this again in the not so distant future. I think most people were interested in my simple LCDS demo which showcased the auto-sync capabilities of the server. For those interested, I have put up the code from that demo at the following site: http://code.google.com/p/jimmycode/


Montreal Flash Camp tomorrow

Tomorrow is a big day for me, I'll be giving the Flex 101 presentation at the first ever Montreal Flash Camp. Just doing final rehearsals now, so hopefully I will give a good presentation tomorrow :)

Loading config settings at run-time

Great article by Christopher Coenraets over on his blog about how to loading configuration settings for your application at run-time. I suggest you read the article but in a nutshell, make an HTTPService call to load an XML file with all your configuration settings and voila!


Dis-liking your old code means you are growing

At the Ottawa FlashCamp last night I was talking with my friend Stacy Young and both of us noted how we always find that looking at code we wrote 2-3 years ago is always bad. Well, the code obviously works, but we hate the way we actually went about writing the code to accomplish something or to solve a particular problem.

The way I see it, this is a good thing, it means that as developers we are growing. We are learning from our various experiences and finding better ways to write applications. It means we are researching how others do things and applying new techniques to Flex development. For me it primarily mean looking into how to better unit test my ActionScript code thus making my applications as robust as possible by using some of what I read on Paul William's blog (Adobe Consulting).

So if you ever see some old code and think its the best thing you have ever written...start asking yourself some questions :)

Back from Ottawa FlashCamp, looking forward to Montreal one

I'm back in Montreal after spending the entire day yesterday in Ottawa and attending FlashCamp at the Adobe offices at night. Was a great evening, saw some cool stuff, like Ryan Stewart demoing Flash Catalyst (Ryan, I hope you found the cigar lounge :) ), my friend Stacy Young doing the Flex 101 session, a look into the future of Flex 4 and some other interesting applications from various individuals.

And now, the next FlashCamp for me is the one in Montreal later this month. Actually the cool thing about that night is that I will be doing the Flex 101 session! That will be really fun for myself personally since I haven't spoken in public for a while now. Also I might be doing a second session, but that is yet to be determined. So don't forget to sign up if you are from the Montreal region.


Montreal Flash Camp

The first ever (as far as I know) Montreal Flash Camp is taking place next month on exactly March 25, 2009. Click here to register now! The contents of the day are the same as the Ottawa Flash Camp which is taking place earlier in the month.


Ottawa Flash Camp (Flex)

The lastest FlashCamp event in Ottawa has been announced and will be held on Tuesday, March 5th, 2009. Full details and registration information can be found here. I will definitely be making the trip from Montreal, as I am interested in seeing Flash Catalyst in action.

Compiled code is bliss

In the past couple of days I've working on updating some functionality in one of our legacy apps at work. The app consists of many JSP pages and after making making one must considered minor changes, the Javascript on the page failed to function as it should. I keep getting an error stating that a hidden form field was no longer available. I was using Firebug in hopes of finding the issue and then resorted to looking thru all the HTML with my eyes and couldn't find any missing tags or anything of the sort. Also doing a "view source" was clearly showing me that the hidden form field was indeed there. So what was wrong?

After looking at the code I changed, I noticed that my IFRAME tag was not being closed with a corresponding IFRAME tag. And that is what cause the Javascript error. Of course nothing told me this was the case, so lost a couple hours of development trying to the root cause of my problem.

Needless to say in Flex this would have never happened. In Flex Builder, if I would have forgotten a closing tag in some MXML file the editor would have shown it to me right away and I would have corrected it immediately. And for those using only the command line Flex compiler, the same would have happened, the compilation would have failed and the appropriate error message displayed with the exact line number.

Needless to say compiled code is a bliss :)

Also, the amount of Java code written to populate HTML Comboboxes is crazy, long live Flex and its data-driven controls, where simple data-binding does wonders. Fewer lines of code, less error prone and thus better productivity.