How to add draw a square selection indicator in Adobe Flash/Flex DataGrid

During our work on our application, we wanted to highlight a selected row in a DataGrid by drawing a colored square around the selection. This turned out to be a bit more complicated than what we originally suspected. The final solution we used?  We wrote our own DataGrid component that just overrides one function.

Our Grid:

package com.ps.UI
{
   import mx.controls.DataGrid;
   import flash.display.Sprite;
   import mx.collections.IList;
   import mx.controls.listClasses.IListItemRenderer;
   import flash.display.Graphics;

   public class PSGrid extends DataGrid
   {
       public function PSGrid()
       {
             super();
       }

       override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number,width:Number, height:Number, color:uint,itemRenderer:IListItemRenderer):void
       {
             var g:Graphics = Sprite(indicator).graphics;
             g.clear();
             g.beginFill(0xF58A38);
             g.drawRect(0, 0, unscaledWidth - viewMetrics.left - viewMetrics.right, 2);
             g.drawRect(0,height-2,unscaledWidth - viewMetrics.left - viewMetrics.right,2);
             g.endFill();
             indicator.x = x;
             indicator.y = y;

        }
    }
}

And to use the updated grid in your application just make sure to import the grid into your source and use as follows:

<psg:PSGrid height="100%" id="certificatesgrid" dataProvider="data">
    <psg:columns>
         <mx:DataGridColumn id="col1" dataField="col1" />
         <mx:DataGridColumn id="col2" dataField="col2" />
         <mx:DataGridColumn id="col3" dataField="col3" />
    </psg:columns>
</psg:PSGrid>

Adobe Flash suffers from split personality disorder

Developing with Flash over the last year I have discovered that Adobe Flash suffers from a split personality disorder. For those who are not familiar, there are two main component library that you use when developing under Flash builder. One is the MX components and the other is Spark.
Obviously, Adobe provided the same component functionality in both library. However, the did put in some minor differences which are more than annoying. For example, on of the things we encounter the most is the different default settings for parallel components. If in an MX container the default will be one, in Spark it will be the opposite. This leads both for a lot of wasted time running after non-bugs. Also makes our adoption of Spark components a lot slower. We just don’t trust their behavior.
My guess? Two competing development groups in Adobe?

Understanding cap tables, part 2

As promised in part 1, we will now start building a simple cap table.  As mentioned before, I will use our own software to build the cap table.  If you would like to, either follow using Excel or just register a free account for your work.

Let’s start with our new company, Demo Company LTD.  Our company has two founders, John Doe with 1,000,000 shares.

Starting the cap-table

Begining our cap-table

Let’s add our second founder Jane Roe with an equal share in the company.

Additional founder

Cap table with two founders

Founder shares are called the common shares.  Those are the actual company shares and all founders and employee options are taken from the common shares/pool.  Investors will usually get a different kind of shares, called preferred as they have advantages over the regular common shares.  We will discuss this later on.    Of course, we are missing one important piece of information regarding the cap-table, and that is the share value.  Usually, the share price for the common round is setup very low to start.  In our case let’s setup the common share at 0.1 cent.  In addition we will set the date for the share grants at 1/1/2010:

Common share price and round date

You can see that after setting the common round price each of our founders is invested or worth 1000$ and has 50% of the company.   This will not impact the cap table summary as there we are only interested in the number of shares.  In our next post, we will put our first angel investor.

Why we chose Flash for our front end

When we started our work on TruEquity a year ago we had a discussion about which development environment/language to use for our front end work.  Our application, which is business oriented, requires the use of a lot of standard UI components such as navigation bars, grids and lists.

We have limited the list to three major candidates:

  1. Flash / FLEX.
  2. Silverlight.
  3. HTML5 + Javascript

What we were looking for is the overall package.  We wanted a combination of ease of use, fast development, easy debugging and easy deployment.

As far as the best development environment, I think Microsoft is the clear winner.  The big problem with Silverlight is a low overall adoption client side wise.  One thing we did not want is to force our users to install any 3rd party content.

The most popular answer right now is HTML5 + Javascript but unfortunately we could not find any good development environment for HTML5.  This would have meant slowing down our development a lot.  In addition, debugging would have been overly complicated.

We went with Flash.   It has the combination of a robust IDE, debugger and a very reasonable component library that allows us to rapidly deploy our application.  Unlike Silverlight, Flash is wildly deployed on the client side so you don’t worry about client installations (or so we thought… but that’s another blog post).

I can’t say we are happy with our selection but I still believe it was the right one.

 

Understanding cap tables, part 1

Ever since I started working in TruEquity I realized how much I did not know or understood about cap tables, stocks, options, VCs and the basic financial building blocks of the company.  As I worked on our software I started to learn, with the very generous help of  our founders, and now I believe I understand the terminology and calculations a lot better.

Let’s start by understanding what a cap table is.  A cap table is used to track all the owners in a startup company, basically a list of stock owners, option holders and investors.  While this list starts up as a very simple list it can get very complicated  when a company starts getting funded by investors and angels.

In every funding round, company stocks switches hands.  Employees are granted options, which will turn to common stock after their vesting.  As time passes more and more stocks switches hands and it becomes harder for a founder to keep track of all the stocks and their disposition.

I have seen a founder “lose” ten percent of his company due to an error in the Excel tracking the company stocks.  In that case, ten percent was the difference between maintaining a majority in his own company.

In future posts, I will show how a simple cap table looks like and we will expand it by demonstrating various common funding scenarios.  As I do work for TruEquity, I will use our own software to demonstrate but you will be able to do the same in Excel if you so wish.

I will also reading Venture Deals: Be Smarter Than Your Lawyer and Venture Capitalist  as it explains a lot of the terms and “tricks” related to funding a company.

Part 2 here… 

 

Another development Wonder

Another one of those days where I spend an hour to try and figure out why the php code doesn’t generate correct XML. Apparently someone thought that it’s a good idea to have a parent code created only if the node name ended with an “s”.

Developing on the Mac

A while ago I recommended using Function Flip for anyone developing on the Mac.  Function Flip allows you to choose specific functions keys on the Mac keyboard and make them work as expected in your development environment (ie.. as function keys).  I actually found another program I’m extremely happy with, Palua.  This small utility which is available in the App store allows you to switch your function keys on the fly using a keyboard shortcut.  It even remembers your choice for a specific program so you don’t have to switch more than once.

Highly recommended!

Test the affiliation system of TruEquity

I moved to a new startup.  In this company we offer other startups to manage their cap-tables and equity using our software on the cloud.  In this case, I’m checking whether I can automatically test the referer to our web-site in order to have the affiliation work correctly.

Our website:     truequity.com

 

Developing on the Mac?

You’ll probably want to take a look at FunctionFlip.  This very small utility allows you to decides how your function keys behave on each keyboard (internal or external).  You could both maintain the special functionality (volume, brightness, etc…) on the keys that you desire and get function keys on the rest.

Starting again

For my new work, a new startup, I’ll start working with Flex. Let’s see how this goes.

Return top

Information

Just writing about my thinking.