2009-07-14

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.

2009-06-19

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.

2009-06-13

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)

2009-06-09

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.