ActionScript 2.0 :: Delete The Duplicate Item From An Array?
Aug 10, 2009
I am working on a project where there are 10 questions and user can answer the question or skip the questions. I want to track the number of questions (which questions) the users have skipped. I am adding the skipped questions in an Array. But if users click on the previous button and skips the same question again, the same question number is added twice to the skipped question Array.My Array looks like:skippedQuestionsArray(1,2,3,4,2,3,4,1);I simply want to trip the duplicate entry and get the output likeskippedQuestionsArray(1,2,3,4);
View 6 Replies
Similar Posts:
Jul 28, 2011
I want to delete the duplicate entries in an array. So I have tried the code I atach to this post. I have proved all the posible combinations but no one seems to work.This is the code I have writen:
Code:
package
{
[code].....
View 5 Replies
Apr 20, 2011
How would I go about removing only the first character of an item in an array? All my items are strings, so for example I want to turn this:
pseudo code:
Array["01234","01234"]
to this:
Array["1234","1234"]
Or if that isn't possible, I could just turn each element into a string, modify it and re-Array it. The issue is using split(charAt(0)) isn't correct syntax. I just don't know what function to call and every search turns up only replacing specific characters, not character at a position.
View 2 Replies
Aug 10, 2009
I am working on a project where there are 10 questions and user can answer the question or skip the questions. I want to track the number of questions (which questions) the users have skipped. I am adding the skipped questions in an Array. But if users click on the previous button and skips the same question again, the same question number is added twice to the skipped question Array. Is there any solution so that I could delete the duplicate entry in an Array.My Array looks like:skippedQuestionsArray(1,2,3,4,2,3,4,1);I simply want to trip the duplicate entry and get the output likeskippedQuestionsArray(1,2,3,4);
View 10 Replies
May 26, 2010
i've deleted an audio file from my flash file and imported a better converted version of the same song to it, but now when i compile a swf of the file i get a msg in the output window saying "multiple copies of sound item in swf". i deleted the original file b4 importing the other 1, but it looks like that doesnt matter. what do i do short of starting COMPLETELY over?
View 2 Replies
Jan 18, 2010
im trying to add a delete item option to a cart, currently i have....
Code:
//populate cart
details.push([vItemCode,vBaseColor,vSecondColor,vThirdColor]);
//loop through cart and output it into the text field
[code]....
how could i add a delete button to remove certain items?
View 3 Replies
Jun 18, 2009
I have created some shapes dynamically at run time by mouse drag, Now i want to delete any selected item the white board.How can i achieve that.Currently i am able to delete the last drawn item through "removeChild()" method, but not the previous items.
View 1 Replies
Sep 16, 2007
Im trying to create a list random numbers from 1-30 but only 10 will appear. but i also need to make sure that the list of random numbers will not have duplicates (eg 1,1,20,14,3,28,4,1,18,21). I had the thought of using an array to store the list of numbers but im stuck with how to properly use an if..then to check if the same number has already appeared.
_scriptRookie
Code:
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
return randomNum;
[Code].....
View 6 Replies
Feb 21, 2008
I want to duplicate a movie clip for each item selected from an XML file. I can't seem to find anything that works. Can somebody give me something to start with?
View 2 Replies
Feb 20, 2011
I have a datagrid with an xmlListCollection bound to it:
<mx:DataGrid id="dgCompetente" includeIn="Competente" x="10" y="66" width="547" height="468"
change="dgCompetente_changeHandler(event)" dataProvider="{colCompetente}"
editable="false">
[Code]......
I want the selectedIndex to remain the same. So, if I delete item 2, the next in the list should be selected. The problem is that if I delete item 2, item 3 will be selected and I have no idea why.
View 1 Replies
May 17, 2011
I'm looking for a solution to the following problem and I'm not sure if this is possible to do with Umbraco.We have a Flash movie which will read in images/paths to images and an accompanying title via XML and we need to be able to manage these through Umbraco.Is it possible to program an event for when an image is uploaded or removed from this specific folder so that it makes changes to the XML file and so it adds or removes the corresponding data?
View 1 Replies
Jul 7, 2010
I have been trying for an hour to clone an array, It seems that nobody has a true reference on how to do it. Two arrays - movieClipArray 1 and movieClipArray2 I want to duplicate movieClipArray1 entirely so that when I addChild(movieClipArray2[0]), it doesn't take away from movieClipArray1 or reference it in any way.
[Code]...
View 3 Replies
Sep 29, 2011
I am trying to figure out how to do the followingi have 2 arrays (array1 array2) containing movieclip objects and i want to temporarily store the objects i want to delete from those 2 arrays in a separate 3rd array (itemsToDelete), so if certain conditions are met, it will run throught the "itemsToDelete" array and delete the items from array1 and array2
View 4 Replies
Mar 23, 2010
I put my mc's in an array.I have another array with strings.when the mc is clicked I want to get its position in the mc array and return the string from the same position in the string array.How do I do that?
PHP Code:
var numBtnArray:Array = new Array;
function addNumButtonsToStage():void{
[code].....
View 4 Replies
Jun 22, 2011
I know how to remove duplicates from an array, but what I'm trying to do is prevent an item from ever being added to an array in the first place if it already exists. I'm pulling in data from an xml feed in a loop, and I thought that searching for that values index would work, but no matter what, the index is always -1. Here's my code:
[Code]...
Maybe I'm misunderstanding the indexOf function, but I thought it was supposed to return -1 if a value did not exist in an array. What am I doing wrong?
View 4 Replies
Aug 24, 2010
I have this code to try to acess the values of the array in the arraycollection but it does not work it actually creates a value to the end of the arraycollection. can anyone tell me what im doing wrong i basically whant to modifys the individual arrays in the arraycollection and add Login_user.
Code:
for(var i:int = 0; i< dispArray.length; ++i){
dispArray.addItemAt({"login_user":"XXX"},i);
}
View 1 Replies
Dec 17, 2010
i want remove array!
PHP Code:
var ar:Array=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
var rnd:Number=Math.floor(Math.random()*ar.length);
ar[rnd]=""
trace(ar)/// but: 1,,3,4,.... !!!!
//i want to delete: 1,3,4...
i want to delete ar[rnd] from my array.
View 1 Replies
Sep 29, 2009
I'm creating a simple "match this to that" game. The wrong matches are stored in an array and put back after the user clicks the "Check Answer" button.
There's one bug that I just can't seem to fix. I've marked the problem below in GREEN. It's best if you read COMMENT 1 before COMMENT 2.[code]...
View 6 Replies
Jan 30, 2010
I have a function where I create an array... How to delete it?
View 1 Replies
Sep 7, 2005
lets say i have an array called numbers with these values: 0,1,2,3,4,5,6,7,8,9,10i want to call a random number of that array, something like this:
Code:
rand = Math.round(Math.random()*(_root.numbers.length-1));
no = numbers[rand];
then when ive got my value (no) i want to delete it from the array... and thats thproblem... i tried to convert the array to a string and then slice it
View 4 Replies
Jan 19, 2009
How can i delete just one 'row' from my array?
Code:
var ThumbArray:Array = new Array();
ThumbArray[0] = ["70317", "name70317", "2"]
ThumbArray[1] = ["28076", "name28076", "3"]
ThumbArray[2] = ["28085", "name28085", "1"]
[Code]......
View 2 Replies
Sep 16, 2005
Here is my code to generate random names:
function GenerateName() {
names = new Array("Dean","Brian","Erik","John");
numberofnames = names.length;
generator = random(numberofnames);
equals = names[generator];
trace(equals);
trace(names);
} GenerateName();
How can i make it so that it deletes the random name that it choose from the arrays???
View 5 Replies
Oct 26, 2009
I have an array containing single alphabet in every index and some of them in the array are duplicates. I'm trying to pick an alphabet and if there is an alphabet in that array, I want it remove from the array.
so lets say if i have 3 "a" in the array, I want all 3 to be remove. But my function only remove one alphabet. How do i make it remove all 3?
Also another question is, if i reach the end of the array how to i remove it? if i use splice it doesnt seem that it will remove the last item in the array.
my code is very simple
for (var i:int = 0; i<alphabetArrayLength; i++) {
if (singleAlphabet_arr[i] == alphabetPicked) {
answer = singleAlphabet_arr.splice(i,1);
}
}
View 1 Replies
Feb 22, 2010
I have a problem with the following Flash AS3-code: When I change "Delete1" to "Delete", the menu item disappears. When I call it anything else but delete, then it reappears. Why? It also occurs when I comment out hideBuiltInItems...
[Code]....
View 1 Replies
Oct 26, 2009
I have an array containing single alphabet in every index and some of them in the array are duplicates. I'm trying to pick an alphabet and if there is an alphabet in that array, I want it remove from the array. so lets say if i have 3 "a" in the array, I want all 3 to be remove. But my function only remove one alphabet. How do i make it remove all 3? (var i:int = 0; i<alphabetArrayLength; i++) { if (singleAlphabet_arr[i] == alphabetPicked) { answer = singleAlphabet_arr.splice(i,1); } }
View 7 Replies
May 4, 2011
way to duplicate an array and then push it into itself?
Do I need to use concat or is there a way I can keep the original array ?
View 11 Replies
Mar 19, 2012
I'm having one of those brain cramp days..I'm trying to add a number of items (sprites) from an array to the stage. There are 5 items in the array, and I want to randomly pick one of them, add it to the stage, and do this 100 times.My end result only has 5 items. I can see why, because when I try to add the same item again, it replaces the previous placed item. I can't think of how to duplicate the item in the array to add as a new Sprite
ActionScript Code:
private var sizes:Array = new Array(15,10,5,20,30);
private var squares:Array = new Array(); // becomes populated with square sprites the sizes
[code].....
View 9 Replies
Jul 20, 2009
I need to remove the value associated with a property in a Flex 3 associative array; is this possible?
For example, suppose I created this array like so:
var myArray:Object = new Object();
myArray[someXML.@attribute] = "foo";
Later, I need to do something like this:
delete myArray[someXML.@attribute];
However, I get this error message at runtime:
Error #1119: Delete operator is not supported with operand of type XMLList.
How do I perform this operation?
View 2 Replies
Mar 10, 2009
I'm trying to use a for loop to remove duplicate array values. I've tried pop, shift, and splice.
View 3 Replies
Jul 9, 2009
This doesn't work at all.[code]...
but adding "removeDuplicates(aPeople);" after "createfile(thename);" has no effect: in other words, when I push the savefile button, it keeps creating clones of the same objects. What can I do?
View 2 Replies