That's probably because the creationComplete event is called just once.
What if you use binding instead?
selectedIndex={ getStateIndex( *employeeStateId:Number, dataProvider:Array*) }
Cheers,
Ralf.
On 2/2/07, malik_robinson <[EMAIL PROTECTED]> wrote:
Hi,
The code works the first time around. First time around meaning click
an employee from the datagrid and the screen changes to a detail view of
that employee.
For some reason every user I bring up after the first user has the same
"State (Arizona) for example" selected thereafter. The first time
around it works, but then when I go back to the employee list screen,
and click a different employee, the detail form populates with all the
right info like (firstName, lastName, email, city, zip), but the state
drop down has the value of the state the other user is associated with
(Arizona).
Its as if the code runs correctly once but when you click a different
user the approriate state does not load, it just has the value from the
prior user. Almost as if once the code runs once, and its being cached
or something. All the other fields load correctly as I view each users
detail view.
I hope I am making sense.
-M
--- In [email protected] <flexcoders%40yahoogroups.com>, "Ralf
Bokelberg" <[EMAIL PROTECTED]>
wrote:
>
> Ah sorry, i haven't read the text ;)
> What if you try it like that:
>
> var selectedIndex : int = 0;
> for ( var i:int=0; i< stateCB.dataProvider.length; i++ ) {
> if( employeeStateId == stateCB.dataProvider[i].stateId ) {
> selectedIndex = employeeStateId ;
> }
> }
> stateCB.selectedIndex = selectedIndex;
>
> Cheers,
> Ralf.
>
> --
> Ralf Bokelberg [EMAIL PROTECTED]
> Flex & Flash Consultant based in Cologne/Germany
> Phone +49 (0) 221 530 15 35
>
--
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35