Flex customized Horizental List
- by muzammal
i have customized Horizontal List (items are image and some text) of a reel with some no of clips . i have customized highlight , un highlight and select style , which will be implemented dynamically and mouse over and out. now pproblem is to make un highlight previously playing clip.
enter code here
styleName="unhighlightedClip" updateComplete="currentlyPlaying();" rollOver="highlighted();" rollOut="unhighlighted();"
.currentlyPlayingClip{
borderColor: #95123E;
borderStyle: solid;
borderThickness: 2;
}
.unhighlightedClip{
borderStyle: none;
}
.highlightedClip{
borderColor: #70BAE7;
borderStyle: solid;
borderThickness: 2;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.HorizontalList;
private var prevIndex:int = -1;
protected function unhighlighted():void{
var selected:Boolean = HorizontalList(this.owner).isItemSelected(this.data);
clipDesription.useHandCursor = false;
clipStartTime.useHandCursor = false;
this.useHandCursor = false;
if(!selected)
this.setStyle('styleName', 'unhighlightedClip');
}
protected function highlighted():void{
clipDesription.useHandCursor = true;
clipStartTime.useHandCursor = true;
this.useHandCursor = true;
var selected:Boolean = HorizontalList(this.owner).isItemSelected(this.data);
if(!selected)
this.setStyle('styleName', 'highlightedClip');
}
protected function currentlyPlaying():void{
var selected:Boolean = HorizontalList(this.owner).isItemSelected(this.data);
var currentIndex:int = HorizontalList(this.owner).selectedIndex;
if(selected)
this.setStyle('styleName', 'currentlyPlayingClip');
// else if(prevIndex != currentIndex )
// this.setStyle('styleName', 'unhighlightedClip');
//
// prevIndex = currentIndex;
}
]]