I'm trying to bring XML nodes into an array so I can sort them in alphabetical order, then display the data in some textfields in a movieclip.I've managed to get the XML displaying fine in the movieclips and all the data in the arrays, but the problem is I'm not sure where to use name.sort();. Right now you can see I have it at the start of the loop that places all the data in, but it will only sort as it populates and hence becomes pointless.Is there a way to add all the data into an array, sort it, THEN display all the data in my movieClips?My XML looks like this:
I just have another really quick question about Arrays, this time about Sorting them. I have just re- written my code to work for matching values from 2 arrays and then adding them to the screen.
however it seems as my matching is way off, it matches the items that are at the same index, which is not always the case
The output for the matches, which should be side by sideis as follows (which is incorrect) Therfore i am trying to find values at diffrent index levels
I tried to sort the Array, but it seems as though the array, cannot be sorted the way i want it. I simply wanted to sort it Acending, but changing it to lowecase would not do what i needed it to do.
This is the code, matchInfo function should do all the work
I'm having a hard time wrapping my head around this problem. I have 2 unsorted arrays that need to be compared, array2 must contain all elements of array1 and array2 can any number of extra elements without affecting the result. I don't see any benefits from sorting the arrays and comparing the string values as array2 can have extra information causing noise.
I need to sort an arraycollection. the problem is that my array is combined from two diffrent arrays, in one the age field is called "AGE", and in the other the age is called "MYAGE".
Now I need to sort the combined array according to age but I got two fields with diffrent names. I can go through the array and change all "MYAGE" to "AGE" but i was wondering if theres maybe a way to sort the array in its current status?
I'm not quite sure how to do this - I'm building an admin interface to sort the order of a series of flash slides into a dynamic presentation. The admin interface pulls the slides from xml and displays each as a thumbnail. The thumbnails, when dragged, reorder themselves in the array appropriately. The problem is, I want the actual array of slides to reorganize itself accordingly. My code is this:
function onThumbPress( e:MouseEvent ):void { e.target.startDrag(); } function onThumbRelease( e:MouseEvent ):void { e.currentTarget.stopDrag(); sortSlides(); [Code] .....
So what I want to do is take the change in the array (say 0 moves in front of 1 in project_thumbs_array) - and make sure that my other array (project_clips_array) moves item 0 in front of 1 as well. I thought something like this might work but it doesn't: project_clips_array.sortOn ('project_thumbs_array.x',Array.NUMERIC);
I am running into some trouble adding an array into another array to create a multi-dimensional array.The code appears as below:
var slideDataArray:Array = new Array(); var slideShowDataArray:Array = new Array(); slideDataArray[0] = xmlData.SlideShowParameters.SlideShowImagesDirectory;[code]........
I am looking for a means of placing the slideDataArray into a 'slot' or value of slideShowDataArray so that I can in the end pass the slideShowDataArray as a parameter to another function.As of now, the last slideDataArray appears 11 times (the loop runs 11 times) in slideShowDataArray and the way the code is written the slideDataArray is unique every iteration of the loop.
I've got a bit that loads a big chunk of xml data about products.I push product info into an array(e.g. productArray), then add that array to another array (e.g. allProductsArray)How do I sort those arrays? For instance, if I want to sort the allProductsArray based on the info in productArray[0]?Alternatively, would something other tha an array of arrays be a better route?This loader loads the same sort of info for many different clients, so the bit to sort on will change.
I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays.I've done this, but it seems like a really slow and ugly way of doing it:
var ar1:Array = [1,2,3,4,5,6,7,8,9]; var ar2:Array = ['a','b','c','d','e','f','g','h']; function merge(...multi):Array[code].....
Is there an inbuilt and more efficient / nice way of achieving this? The result does not need to be in the same order as the input - completely unsorted is fine.
A little explanation: Im making a random arranging number Array. So instead of using a loop and assigning 0 to first array element, 1 to second, etc.I need to make it totally random but without repeating any numbers. To do that I made a second Array that will have the same number of children to serve as a reference.Each of them will be an Object with a property "num" , wich will be its actual number, and a property "called" wich defaults to false.Like this:
ActionScript Code: for(var i:int=0;i<vQuantity;i++){ ranArray.push( new Object() );
I've had a problem for awhile that was really odd. After some intense debugging, I realized the problem lied in setting an array equal to another array.[code] When setting one array equal to another, the values aren't copied over, but a reference to that memory is stored. So no matter which variable you change, they are both references to the same memory and thus both will reflect the changes.With other data types, this doesn't happen.I could fix it by looping through t1 and using push() to add each index from t1 into t2, but that seems a little messy.
correct syntax for pushing variables to arrays within arrays? I have searched many threads but found nothing that exactly answers my query.I have a class (Brigade) which amongst other variables contains an array (BrigadeUnits) This is the third element.. My Brigades are stored in an array called AllBrigades. I now need to fill the BrigadeUnits array with objects of my Units class.The hierarchy I want to create is as follows:
AllBrigades (array of Brigades) Brigade (object) BrigadeUnits (array within Brigade object) Unit (Object to be stored in BrigadeUnits array)
I have tried various approaches including the following, assuming that I am addressing the first Brigade in the array:
I have been deveolping my new site, which is in it's early stages and have most things working ok but i need to open new windows from buttons in the main swf file. please check out my link to see for yourself! new windows load in the same window ad the main swf. [URL] I have been using this code on the thumbs on my design and illustration sections
on (release) { getURL("javascript:NewWindow=window.open('url.html ','newWin','width=1133,height=425,left=425,top=113 3,screenX=1133,screenY=425');NewWindow.focus();voi d(0);"); } each of the thumb windows being a different specified size.
Is there any way in Flex where in we can sort an arraycollection based on strings .I have a dataprovider with strings like "Critical" "High" "Medium" "Low" where in I need to sort it in such a way that I need Critical to be displayed on the top and next High , Medium and Low follows.
I have an advancedDataGrid and I would like to sort the adg according one AdvancedDataGridColumn(studyDate) which use strings in format DD/MM /YYYY(I receive like this from the server):But i find another problem, I need to sort the columns of the adg the first time it displays so I used the following function but It doesn't sort from the recent day to old one, I do not know what I can I do cause I set sort.descending= true, any ideas?[code]
I have a one comboBox that I fill as: for (var key:String in values) { conns.addItem(key); }
After that I sorted my ComboBox as: private function sortConnection():void { var dataSortField:SortField = new SortField(); dataSortField.name = "data"; dataSortField.numeric = true; var numericDataSort:Sort = new Sort(); numericDataSort.fields = [dataSortField]; conns.sort = numericDataSort; conns.refresh(); }
And on finish I want to select item on my specific value in ComboBox. How can I do that? I try: for (var ii:Number=0; ii<combo.rowCount; ii++) { var item:String = combo.getChildAt(ii); if (item == name) { index = ii; }} But does not work. I do not know where I made mistake, and how I can select on specific item in my combobox.
i just started with isometrics. i got the 3d to 2d coordinates working but i cant seem to get the z sorting to work. please check the fla if you have knowledge in the subject.
Trying to re-sort an array of objects from: var arr:Array = new Array({num:0},{num:1},{num:2},{num:3}) to var arr:Array = ({num:0},{num:3},{num:1},{num:2})
Rows B, D and E do not sort correctly, basically because I am assuming they have numbers with unmatching or too many places. I can not find any help online with this. The columns with percentages work fine unless they go over 99%. ?[code]...
In the project I'm working on, there are towers the user can place. However, it you place a tower higher then another one, it appears infront of that one, which looks weird.I want to be able to arrange all the towers so that that does not happen.There is an sprite called towerHolder holding, which all the towers are children of, and an array called towerArray, which the towers get pushed to when they are created.I tried clearing towerHolder, then running the sortOn() function on the array, and then adding each tower back to the towerHolder, but the towers just seem to be randomly placing themselves irrelevent to their height.Here's my code for the relevant parts:
Actionscript Code: function clearTowers():void { while (towerHolder.numChildren > 0) { towerHolder.removeChildAt(0); }}function orderTowers():void { clearTowers();
have a twodimensional array that consists of 6 other arrays(like array[0 to 5][0 to 4]). The [4] of each sub-array is a indexnumber that i'd like to use for sorting the array[0][x] toarray[5][x] according to their array[x][4]-value. How would I do
would anyone beable to help with sorting out an XML file, what I have is a tooltip that loads in via XML and exported from flash. the XML loads in 2 text fields, field and field2. what I am trying to do is add a button also to the tooltip so that you can click and go to a url. this is what I have in my XML file;
How would I do to sort this array by the largest sum and not just the first number? var myArray:Array = new Array(100, 200, 9); myArray.sort(Array.DESCENDING) //puts out (9, 200, 100) How would I do to get it (200, 100, 9)?
I have a datagrid that uses a custom cellrenderer class to allow me to use a combobox. I have an invisible column that holds the value returned by the cellrenderer when the combobox value is changed. BUT sorting is wonky. Since what really lives in the combobox column individual cells is an object, it never really sorts properly. Is there a way to fire a sorting event to the column that holds the real value?