ColdFusion Muse

Late Night Rant on the Flash Help Files and the Datagrid

Mark Kruger January 20, 2006 12:15 AM Flash Remoting Comments (6)

So I'm sitting here after a long day of Flash programming and thinking about how much I hate the flash help system. The little window is annoying in the extreme. The font size is too small. The interface is counterintuitive. I can't ever find anything - at least not easily. If I select a combo box and hit the little "help" button in the properties window (I really aught to say "hideous" properties window) I would expect there to get help on the combo box - right. Nope. It always says "sorry - no help can be found for this component." But when I do a search for "combobox" it turns out that there is page after page of help. It's sort of like being white trash at a fancy restaurant. I can see all the empty seats but the hostess just keeps telling me, "sorry... we don't seem to have any openings..."

The help files do include samples, but they never seem to be samples of anything I can use. Take the datagrid for example. A typical application using a datagrid would load it with a data object for editing and then pass the edits back to a component for updating - right? Ok, where is the example for simply getting a row of the current dataProvider? There are about 20 different notes on how to change the color of a cell, how to fire cell edit events, how to get a list of columns for formatting. The help files have 3 pages of information on style formatting for every 1 example of actually working with data.

muse.setStyle("faceColor","RedWithFrustration");

Anyway, to solve the problem of "working with a row" I use the following approach that tracks edits. When I populate the grid I have developed a convention of sorts. I add an extra "hidden" column of data to the dataProvider. I call it edit or editflag or whatever. For example:


for(i = 0; i < myRs.getLength(); i++) {
         
         
         tmp = {   ID: myRS.getItemAt(i).bom_id,
               DTADDED: myRS.getItemAt(i).DtAdded,
               PART_NO: myRS.getItemAt(i).Part_no,
               PART_DESC: myRS.getItemAt(i).Part_Desc,
               UOM: myRS.getItemAt(i).UOM,
               QUANTITY: myRS.getItemAt(i).Quantity,
               PRICE: myRS.getItemAt(i).CostPerUOM,,
               EDIT: 0
               };
         dataArr.push(tmp);
      }
      _root.my_gd.dataProvider = dataArr;
Then I create a "cellEdit" listener that is fired whenever a value in a cell changes.

   // new listener object var bomCellListener:Object = new Object();

bomCellListener.cellEdit = function(eventObject){
         
      my_gd.editField(eventObject.itemIndex, "EDIT", 1);
};

my_gd.addEventListener("cellEdit", bomCellListener);

This cellEdit listener serves to flag "rows" in my dataset that have been edited. To save the data I might use a polling application, a button, a dialog or whatever, but when it comes time to fire the "save" function I simply loop through the values and extract only the rows that have been edited to send back to the database. In this respect it works very much like the old "cfgrid".

I know there is also a way to bind a table to the grid in a similar way to a .NET control. I have a natural aversion to leaving any database updates to a wizard or "behind-the-scenes" code (remember cfupdate - shudder). I want to write the databases code and completely control the data in and out - so I have avoided this bound approach. Still, I if anyone has a good tutorial on it I'd be willing to repent :)

  • Share:

6 Comments

  • Clark Slater's Gravatar
    Posted By
    Clark Slater | 1/20/06 1:38 AM
    You need Flash Resource Manager courtesy of Mike Chambers - you will never look back or have to deal with the teensy windows etc. in the IDE.

    http://weblogs.macromedia.com/mesh/archives/2004/0...
  • Al's Gravatar
    Posted By
    Al | 1/24/06 12:34 PM
    Surely yours can't be as bad as mine...

    I flicked opened the help in Flash for the first time after upgrading to 8 and this is what I see:

    http://img228.imageshack.us/img228/9758/flashhelp3...

    N.B. apart from the cropping that's an unaltered PNG - the miniscule feint and blurry text is not due to JPEG compression or resizing.

    Somebody really goofed - that's painful to read.
  • Al's Gravatar
    Posted By
    Al | 1/24/06 3:17 PM
    OK I found a fix (only verified on WinXP - other installs should be similar but YMMV).

    This describes how to edit the CSS files used by the Flash Help panel:

    http://www.macromedia.com/go/tn_18954

    Unfortunately this did nothing for me so I went poking around, checking their JavaScript, etc...

    Many expletives later, the CSS file the Flash Help panel _actually_ uses (on my install anyway) can be found at:

    C:\Documents and Settings\All Users\Application Data\Macromedia\Flash 8\en\Configuration\HelpPanel\_sharedassets

    I guess it should use the CSS file at the similar location in my user directory... but that would have made sense.

    The CSS file used by the panel for my install is help_pc.css
    I chose a font size of 1.1em

    An easy way of finding a font size you're comfortable with is to edit the appropriate CSS file and then open "shared_helpnotfound.html" which should use the CSS file you have just edited in the same way as the Help panel does (saves having to open Flash, Help multiple times).

    Hope this helps.
  • mkruger's Gravatar
    Posted By
    mkruger | 1/24/06 3:30 PM
    Al - now that's a helpful tip - thanks!!
  • chris bizzell's Gravatar
    Posted By
    chris bizzell | 10/4/07 8:18 AM
    have you found any good info regarding Remoting and AS 3.0 using ColdFusion?
  • Tiggi's Gravatar
    Posted By
    Tiggi | 9/18/08 12:05 PM
    Hi there,

    I have similar problem and don't know how to solve it.
    I am using flash forms in ColdFusion and have 2 grids, grid1 list of all items and grid2 list of selected items for the category.
    I am using drag and drop to move items from grid1 to grid2. The problem is that the already selected items are conflicting with items that I move from grid1, and only items that have same index in both grids. So if I have 10 items in grid2, the first 10 items in grid1 will conflict with those when I try to save.
    Is there any way to reindex items once I transfer them to grid2 or anything else that would solve this?