Flash CS3 fl.controls.TileList allow no selection

Using the fl.controls.TileList I’ve encountered a little problem, I wanted to be able, when NOT in multiple selection (allowMultipleSelection=false), to select and deselect an item leaving the TileList with no items selected.

Using the basic TileList class  you cannot deselect an item once it has been selected, to do so you need to select another item but that means that you cannot get a no items selected state.

Get Adobe Flash player

Using the extended one you can select and deselect the same item leaving the TileList with no items selected

Get Adobe Flash player

In Flash CS3 all the UI components come with their source code and you can find them here (those path are for default installations):

Mac:

/Applications/Adobe/Adobe Flash CS3/Configuration/Coponent Source/ActionScript 3.0/User Interface

Windows:

c:/Program Files/Adobe/Adobe Flash CS3/Configuration/Coponent Source/ActionScript 3.0/User Interface

and here is the class:

as3File

To use it you’ll need to drag a TileList into the library of your FLA file.

This entry was posted in AS3, Flash, components and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • /* As kind of a mini-tribute, I would have like to propose for this code a little addin' for those, like me, who might need some unSelectAll() function, with a totally "free triggering mode" (I mean without using any event like the "click" one)
    I needed this because my TileList is interacting with some other components so the selectedItem can change even without a direct click on the list !
    I am not sure this is really the cleanest way to do it (I mean using a public void) ...But it seems to work ;)
    (My apologies about my probably aweful english syntax, I am a french people soon escaped from school !) */

    /** (May) Allow unselecting all items of the list from any other function call **/

    public function unSelectAll():void
    {
    var renderer:ICellRenderer;
    var itemIndex:uint;
    for (var i:int=0; i < selectedItems.length; i++)
    {
    renderer = itemToCellRenderer(selectedItems[i]) as ICellRenderer;
    itemIndex = renderer.listData.index;
    renderer.selected = false;
    }
    _selectedIndices = [];
    }
blog comments powered by Disqus