[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Flex Array Won't Re-Initialize Itself

Asked by blue44 in Adobe Flex, ActionScript

Tags: Flex, ActionScript

Hi,

I have a very strange bug occurring in my application.  Basically, I have one array (masterReps) that has a list of user names.  As different users are selected, I'm trying to have that user move to the the top of a second array (tempAssignedReps).  This actually works the first time, but every subsequent call to the function results in the last uname being appended just below the current uname at the top of the list.  It's as if no matter what i do, I can't reinitialize the array.  

I'm sure I'm missing something simple here but just can't see it.

Thanks!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
//this array never changes.  it has the master list of user names
var masterReps:Array = new Array();
 
 
public function doBox(uname:String):void{
 
	var tempAssignedReps:Array = new Array();
 
	if(tempAssignedReps != null){
		tempAssignedReps.length = 0;
	}
 
	tempAssignedReps = masterReps3;
 
	for(var cnt:int=0;cnt<tempAssignedReps.length;cnt++){
 
		if(tempAssignedReps[cnt].toString() == uname){
			tempAssignedReps.slice(cnt,1);
		}
	}
	tempAssignedReps.unshift(uname);
	cbRep.dataProvider = tempAssignedReps;
 
}
 
<mx:ComboBox id="cbRep"/>
[+][-]10/28/09 01:01 AM, ID: 25680751Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/28/09 09:31 AM, ID: 25685091Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/29/09 01:07 AM, ID: 25691417Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 05:27 PM, ID: 25745978Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 12:05 AM, ID: 25747497Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625