Archive for July 7th, 2010

Deselect LinkBar Flex 3 / 4 when Provided with Viewstack DataProvider

If you want to manage a Linkbar control by clicking on same link multiple times… you might be looking like some thing below…


package com.ranjitfx.library
{
import mx.controls.LinkBar;
import mx.controls.Button;
import flash.events.MouseEvent;

public class RFXLinkBar extends LinkBar
{
public function RFXLinkBar ()
{
super();
}

override protected function hiliteSelectedNavItem(index:int):void
{
var obj: Object = super;
var child:Button;

// Un-hilite the current selection.
if (selectedIndex != -1 && selectedIndex < numChildren)
{
child = Button(getChildAt(selectedIndex));
child.enabled = true;
}

// Set new index.
obj.selectedIndex = index;

// Hilite the new selection.
//Uncoment following if you looking for assigning -1 to selectedIndex to manage buttons.
/*if (index != -1 && index < numChildren)
{
child = Button(getChildAt(index));
child.enabled = false;
}*/
}

}
}

Should be helpful…
Comment for providing inspiration……..

Advertisements
Advertisements