• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Code Fix!

Add the following below the existing code:

var gridHeight:Number = 200;

function toggleColumn(columnName, buttonName)
{
    var foundColumn:Boolean = false;

    // find the column
    for (i=0; i<test_grid.columnNames.length; i++)
    {
          if (test_grid.columnNames[i] == columnName)
          {
                foundColumn = true;

                test_grid.removeColumnAt(i);
                test_grid.setSize(test_grid.width-175,gridHeight);
                test_grid.spaceColumnsEqually();
                _root[buttonName].label = "Add " + columnName;
          }
    }
    if(!foundColumn)
    {
          test_grid.setSize(test_grid.width+175,gridHeight);
          test_grid.addColumn(columnName);
          test_grid.spaceColumnsEqually();
          _root[buttonName].label = "Remove " + columnName;
    }
}

hair_btn.onRelease = function ()
{
    toggleColumn("Hair Color", this._name);
}

bigplans_btn.onRelease = function ()
{
    toggleColumn("World Domination", this._name);
}

single_btn.onRelease = function ()
{
    toggleColumn("Single?", this._name);
}


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint