i am tring to check the values imn my array but for some reason the hit is never trace. So is the value o0f cat not found in the array. if not what do i do to find the value cat
ActionScript Code: var numbers_array = new Array("cat"); for( i =0; i < numbers_array.length; i++){
let's say you're passing an object to a function {title:"my title", data:"corresponding data"} how can I get the function to know what the names of the items/sub-objects are (title and data) without specifying them?
I have an array of objects, I separately have a reference to one of the objects in this array (in particular, the object dispatched an event and its reference is the event target, which is what I have). How do I find this object in the array and remove it from the array?
how do you find an object's index / position within an array in flash actionscript 3? I am trying to set a conditional up in a loop where, if an object's id is equal to the current_item variable, I can return its position within the array.
After chatting with my coworkers, they have suggested I enumerate this into a large array of indexed values with references to which index they are associated with, for instance [code]...
I am working with the listbox component and trying to find out the index of the top item that is displaying.Obviously this is 0 by default but if the scrollbar has moved down then this will change, I just can't find out how to get the value!
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{
In a spark list I could use the change event to find out which item has been selected or deselected. The dispatched IndexChangeEvent object has the properties newIndex and oldIndex holding this information.
But with multiple selection allowed this doesn't work anymore because newIndex and oldIndex could refer to indices of still selected elements.
A solution would be to copy the selectedIndices vector to another variable and compare this variable with selectedIndices after a change in selection, but this seems to be somewhat complex.
Does anyone know if there is an easy way two get the index/item a user is deselecting while other elements are still selected?
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?
I have prepared a simplified test case for my question. It will run instantly in your Flash Builder if you put the 2 files below into a project.I'm trying to display a List of strings and a confirmation checkbox in a popup:In the real application I dispatch a custom event with the string selected in the list, but in the test code below I just call trace(str);My problem: if I use click event, then the window closes, even if I click at a scrollbar (the !str check below doesn'twhen an item had been selected in previous use). And if I use change event, then the window doesn't close, when I click on the same item as the last time.riting a custom item renderer and having a click event handler for each item seems to be overkill for this case, because I have strings in the list.Test.mxml: (please click myBtn few times - to see my problems with click and change)
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.
I want to know if there is a method or some code to add new items to an array, but it want the items have the name of the buttons's instance name, or the label's name, so when i push the button, it adds its name to an array. Here is my code:
ActionScript Code: tauri.addEventListener(MouseEvent.CLICK, addAddress); abydos.addEventListener(MouseEvent.CLICK, addAddress); tollana.addEventListener(MouseEvent.CLICK, addAddress); dialNow.addEventListener(MouseEvent.CLICK, dialTo); var tauriAddress:Array = ["tauri","abydos"]; var newAddress:Array = new Array(); function addAddress(event:MouseEvent):void { newAddress.push();
I don't know if I should use the push method here, tell me what to put here for adding the instance name of the button to the array trace(newAddress); }
I'm trying to add an item to an array, but when I do, it keeps the results (prizeField) from before and adds the new ones to it. i.e. at the beginning if I push a string to the array I have 4 items. If I push another, I then have 9. Then 15 and so forth. Here is my code:
Code: var myFlexParent:Object; var prizeArray:Array = ["apples", "bananas", "cranberries"]; var textFormat:TextFormat = new TextFormat("Cairo", 48);[code].....
I know that I need some sort of removeChild() in there, but I cannot get it to actually work.
When the combo box is changed it will add items to another combo box, i.e if africa is chosen, all the countries in africa will be listed in the second combo box.
At the moment i am manually adding in all the countries, _root.combo1.addItem("Label", "Data");
for 60 countries that would be messy code, is there a way to do it in an array cause my advanced actionsript isnt that good. But i will need to be able to get the data of a country out later ....
I have a tricky problem in that I have an array that has been populated with strings ("item1", "item2", etc). However, at a certain point I need to pull one randomly out of the group, via a random number function. The issue is I cannot reference the items in the array by a number, I get an error. So when I try to get myArray(5) it doesn't work.
How can I work around this so I can grab a random item in my string array?
I have 2 arrays & 2 checkbox repeaters: the second gets populated w/ items selected from the first. I can add the items no problem. How do I then delete the item if it gets deselected from the first checkbox repeater?
I have two two-dimensional arrays, and this line of code:
openListParents[compWith] = openList[olID];
Does it work? Yes. However, openListParents[compWith] becomes openList[olID], but I want openListParents[compWith] to be the value of openList[olID]. This is what I get when I press CTRL+ALT+V:
[Code].....
This is because openList might change, and I want the value of that openListParents in the array to be the value of the openList at the time when the code is run.
I have an array of questions for an interactive quiz game. When you answer a question, functionally I want that question to be removed from the array (cat4Questions) so that it won't come back for the player so I tried to splice it.I wasn't sure if it was working so I traced the array. While I was expecting "question1, question2, question3, question4" to be traced, "question1, question2, question3, question4, question5" was the result of my trace.This is the line of code where I try to splice the array:cat4Questions.splice(cat4Questions.length,1);trace(cat4Questions);