[flexcoders] previously selected indices in List?

2009-03-13 Thread gwangdesign
Hi,

This might be a simple one but I am having a hard time figuring it out: How do 
I get the previous selectedIndices when a ListEvent.CHANGE event occurs on a 
List control, within the Flex component framework?

Basically I'd like to change all the selected item renderers states on a List 
control and I'd like to wrap this functionality into a subclass of List. 

If I am not subclass List or ListBase, everything seems straightforward. But if 
I extend List class, how do I capture this changes?

private function listChangeHandler(event:ListEvent):void
{
_bSelectedIndicesChanged = true;
invalidateProperties();
//this gets exectuted before commitProperties.
_prevSelectedIndices = selectedIndices.concat();
}

By the time commitProperties() gets called, _prevSelectedIndices = 
selectedIndices.concat(); has already been executed.

What am I missing here? Are there any easy way to either get previously 
selected index or previously selected indices on a List component?

Thanks.



RE: [flexcoders] previously selected indices in List?

2009-03-13 Thread Tracy Spratt
You are misunderstanding the invalidation process.  invalidateProperties()
does not call commitProperties, it just tells the framework that
commitProperties needs to be called.  The line after invalidateProperties
will be called immediately, commitproperties will be called at some later
time.

 

I haven't worked with multi select list a lot but I would set the
selectedIndices whenever the selection happens.  I suspect that the indices
have already been changed when the handler is called.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of gwangdesign
Sent: Friday, March 13, 2009 12:58 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] previously selected indices in List?

 

Hi,

This might be a simple one but I am having a hard time figuring it out: How
do I get the previous selectedIndices when a ListEvent.CHANGE event occurs
on a List control, within the Flex component framework?

Basically I'd like to change all the selected item renderers states on a
List control and I'd like to wrap this functionality into a subclass of
List. 

If I am not subclass List or ListBase, everything seems straightforward. But
if I extend List class, how do I capture this changes?

private function listChangeHandler(event:ListEvent):void
{
_bSelectedIndicesChanged = true;
invalidateProperties();
//this gets exectuted before commitProperties.
_prevSelectedIndices = selectedIndices.concat();
}

By the time commitProperties() gets called, _prevSelectedIndices =
selectedIndices.concat(); has already been executed.

What am I missing here? Are there any easy way to either get previously
selected index or previously selected indices on a List component?

Thanks.