ActionScript :: Push To Multidimensional Arrays And Later Retrieve Just One 'row'?
Jan 20, 2010
I am reading a set of latitude & Longitude Coordinates that define a polygone area. They are keyed to an area ID and I retrieve them from a SQL database. So for example, Area ID 153 might have 20 coordinates and area ID 77 might have 11 coordinates. I wish to save these in a 2-D array indexed by the area ID, and where each coordinate pair is combined into one Google LatLng object. At a later point I wish to retrieve just one row i.e. the set of coordinates for one area, and send them to a function that accepts an array of coordinates and draws the polygon on a map. Here's what I have:
private var coordsFromSql:ArrayCollection = new ArrayCollection();
var polyArray:Array = new Array();
for each(var item:COORDINATES in coordsFromSql)
[code].....
View 2 Replies
Similar Posts:
Feb 12, 2008
I have my xml coming in just fine and I need to put it into an array now..I need it to basically end up like one of these:
Code:
var contentInfo:Array = [{title:"Select a Ringtone", keyID:"", keyName:"", fileID:""}, {title:"Living Together", keyID:"17117", keyName:"circa.ringtones.livingtogether", fileID:"1769_w_a18cwob6.mp3"}, {title:"The Greatest Lie", keyID:"17119", keyName:"circa.ringtones.thegreatestlie", fileID:"2026_w_i2hdaw10.mp3"}, {title:"The Difference Between Medicine and Poison is the Dose", keyID:"17120", keyName:"circa.ringtones.thedifferencebet", fileID:"2025_w_yskkb1oc.mp3"}];
so you can see their are 4 variables I need to push into one slot.
View 1 Replies
May 17, 2009
In my example I have established root items (item1,item2,item3 and item4) and sub-items underneath them, and I can easily access the values at the sub-level, but I can't figure out how to output the values on the root level, if I use treemenu[0] it doesn't output "item 1" but the values on the sublevel, how can I point to the actual value on the root level? so it would output for example "item 1"?
Code:
var treemenu:Array = new Array(new Array());
treemenu.push("Item 1");
[code]....
View 2 Replies
Jul 6, 2010
I have this array
Code:
_global.itemsSelected[1][0]=20;
_global.itemsSelected[1][1]=60;
_global.itemsSelected[1][2]=10;
[Code]....
View 2 Replies
Feb 3, 2010
i need to compare two multidimensional arrays against each other
var aa:Array = new Array(1,2,3);
var bb:Array = new Array(1,2,3);
if(aa == bb){
trace("same")
}
dose not seam to worke, even in a 1d array :/
View 3 Replies
Jan 31, 2010
I am new to flash programming and am trying to create an empty 2D array.I have the Code:
ActionScript Code:
var squareList:Array = new Array(new Array());
Init();
[code]........
View 1 Replies
Apr 27, 2010
I do not understand how to pass an array to PHP! I have a number of multidimensional arrays that I would like to pass over.
Example:
array1 -
character[0][0] = "dog";
character[0][1] = "cat";
character[1][0] = "dog";
character[1][1] = "frog";
View 0 Replies
Mar 10, 2011
Below you can see this rotation-towards-mouse experiment I wanted to try out. I made a tilemap using a 2D array and my objective was to get all the "hands" pointing towards the mouse. I almost got it working in the sense that all of the "hands" are rotating but they are all rotating the same way, namely they all rotate exactly like the last hand - i.e. the last object in the array.You can try it with this code to see what I mean. You just need two movieclips in the library, one called Hand(preferably not a circle) and the other called Ball but it can be anything.
I actually tried using similar code involving a drag-and-drop function and that worked fine. I could move around each tile separately but for this to work it seems I have to add the listener differently. At least that's my theory but I haven't found the correct way.his is probably super-simple but my googling and trial-and-error'ing haven't turned up anything yet
ActionScript Code:
var hand:Hand;
var tileMap:Array = new Array();
[code]....
View 1 Replies
Sep 13, 2006
what i owuld like to do is ceate flash collections
name:value
name2:vale2
similar to collection in cfml and hash tables in vb.net is this possible or do i have to create multi dimensional arrays?
View 1 Replies
Jan 15, 2010
I'm pretty sure this is a common requirement but a bit of googling hasn't provided me with a satisfactory answer so far.Basically, I need to shuffle a 2d array of Points (co-ordinates) so that they are still the same co-ordinates, but stored in a different order.
View 1 Replies
May 12, 2009
So I'm coding a maze in Flash using ActionScript 2.0. I'm using a 2D array and with that I will give each point a value, either 1 or 2. I then plan to use modulo and an if else statement to pull a brick movie clip from my library. Here's what I've coded so far with the 2D array. This is my first time using this array and I'm unsure wwether I have coded this correctly. how do I use this array now to assign the values of 0 and 1?
[Code]...
View 2 Replies
May 13, 2011
I have an array of movie clips (representing band members) which have various properties, among them them a property which tells where the band member went to after they left their current band. For those who formed a new group, I want to create an array. Within that array, I want to group all the ones that left for the same group into secondary arrays. So, if you had five band members and 2 of them left for group X and 3 left for group Y. What's the best way to do this? This is, roughly, my code:
[Code]...
Alternatively I suppose if I could do without a multidimensional array and just loop through all the members and say - for those members whose group is the same, perform this function, with the name of that same group passed as the parameter for the function. I guess the trouble I'm having is identifying who's the same.
View 2 Replies
Nov 29, 2010
I am creating a menu buttons with the use of array. A reference link is given below. --
grandmother.increating such associative buttons with array (actionscript 2).
View 0 Replies
Aug 15, 2004
This works:
[code]...
But when I try to generate an empty array with two variable dimensions using
[code]...
I get a 1x10 array. What am I doing wrong? Is this wrong:
[code]...
View 1 Replies
Jul 1, 2011
TL;DR version: how do I add more values to the 0th row of an array?[If that's too vague, read on.]What I'm trying to do currently is make a tilemap engine. I have an multidimensional array that is sifted through when the program begins that determines what type of tile is added to the stage which was then put in its appropriate place. These tiles scroll when the player moves.
Now, the problem is, I expect to make huge maps. Putting a large amount of children (tiles) on the stage makes the program incredibly laggy, so to fix this I created another multidimensional array that held the values of the tiles that are currently in the field of vision of the player.
the values in the new array shifts and moves along with the player, gets the children that will be left behind and deletes them. To keep things short, the player would not notice the addition and removal of the tiles, because the tiles are added at the position where the player is currently moving and the tiles that are removed are removed where the player is moving away from.
The issue I am having lies with moving up and down. The addition and removal of tiles follows a very strict process:
1. shift the array that holds tiles in the player's range of vision so that new tile values can be added.
2. add children (tiles), assign their names, add the name to the appropriate place in the array and move the child (tile) to the appropriate place on the stage.
3. Delete the tiles left behind.
4. Remove the names of the children that were deleted from the array.
To move up, I would have to unshift the array (so that all the rows move down one), add the names of the new children(tiles) that will appear directly above the range of view, then delete the children that are named in the last row of the array and pop the last value in the array (which, since this is a multidimensional array, is not one value, but the entire last row of children names). The problem is, after I unshift the array and add a new row with only a single value in it, I can't add more values into the row!
(the name of the array that holds the names of the children in the player's range of view is containmentUnit.)
I have tried these,
Code:
containmentUnit[0].push("test");
Code:
containmentUnit[0].splice(0, 0, "test");
but it always comes out the same way-- with an error message that reads:
TypeError: Error #1006: value is not a function.
at storage/update()
how I could add some values to that first row?
View 4 Replies
Aug 15, 2004
This works:
Code:
var game:Array =[
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[Code]...
I get a 1x10 array. Is this wrong:
Code:
for(v=0;v!=vlength;v++){
game[v]=new Array(hlength);
}
Ow eh im using Flash MX2k4 v7.2
View 1 Replies
Sep 27, 2011
I may be confusing myself as I seem to do this whenever working with multi-D arrays... but perhaps you guys can set me back on the right track. I'm working on a flash application that is kind of a game. It's a memory test consisting of 10 blocks, it is very similar to the one shown in the video below.... but there are some differences where this one wouldn't for my situation. (apparently I can't link) The title on youtube is Spatial Span... it will be the first result if you search for "Spatial Span" The difference is that there are 2 sets to every level and you only need to get 1 correct to move onto the next level.
[Code]....
View 0 Replies
Feb 6, 2010
I have some working code that I created in C and ported over to the PSP. I decided that I wanted to work with it in flash and ported it over to AS3.0. It took me a bit to get used to the graphics commands but over the course of a few days I managed to get the code typed in. I compiled it and watched my baby come to life in a new environment. But there was something wrong, everything looked correct but felt wrong. I looked closer and saw what the problem was. The maze is not being displayed like how I put it in.First let me give you some visuals to look at.
[Code]...
When I run the program this is how flash displays the mazeThe starting position is the bottom left corner. Which in flash terms is 13,1. Why oh why is flash rotating and then inverting the map? If row = 13 and col = 1, then [row-1][col] should equal 12,1. I've broken it down and analyzed it till my brain hurt... I can not find any reason for this bizarre behavior... All the program does is interpret the 1's and 0's to know where to place a wall. If the square has a 1 then a wall goes there, if not then its open and the player can walk there. I look at the surrounding squares and then draw what I see... no rotating and no inverting is done.I remind you that the code works as intended in C. So I don't think its a coding issue.
View 10 Replies
Mar 8, 2012
I have a string variable that looks something like this:
2012-03-07 135.06 135.91 134.93 135.69 143616800 135.69
2012-03-06 135.35 135.43 134.36 134.75 202129900 134.75
It continues like this, a list of reoccurring variables seperated by spaces, for a few more lines.How can I separate the string and push the different variables into their appropriate arrays. The end result should look like this:
dates = [2012-03-07, 2012-03-06]
variable1 = [135.06, 135.35]
variable2 = [135.91, 135.43]
View 10 Replies
Sep 13, 2010
so I have a JSON link that contains a couple of nodes (not sure what you call them in JSON) that I need to put into arrays in ActionScript, but I'm still having trouble trying to trace out all the specific node content.I found a similar question here, but the fix just showed how to trace out the entire JSON file (which shows up in my output window as [object Object],[object Object],[object Object],...)first node: {"captions":[{"content":"[hello world] ","startTime":0,"duration":4000}
My code:
private function onCaptionsComplete( event:Event ):void
{
//var jsonObj:Object = JSON.decode(event.target.data);[code].....
captions: undefined
TypeError: Error #1010: A term is undefined and has no properties.What I would like to be able to do is put the content data into the captionsContent Array, and the startingTime into a startingTime Array, same with the duration data.
View 1 Replies
Oct 25, 2009
I have problems defining indexed array with actionscript. The task is following. I have a board of point objects. I need to store them into one array, so I can access each point using simply it x,y coordinates. for example to get point one I want to be able use points[1][1], etc. I read the doc here [URL], and realized that I don't understand how to initialize array for my needs. (Especially when it can contain from 10 to 15 rows and columns, so it will be quite hard to use following notation: masterTaskList[0] = ["wash dishes", "take out trash"];, as suggested in docs.) What I am doing is:
[Code]....
View 3 Replies
May 16, 2011
I'm just beginning to learn AS3 and I've been reading Colin Moock's Essential ActionScript 3.0.(I've been doing some exercises on how to randomly choose elements from arrays). All of the book's example codes that I've tried so far (in FLASH CS5) seem to work pretty well. But I'm having a bit of problem with the example code below which is found in chapter 11 (Arrays):
var row1:Array = [6, 2.99]; // Quantity 6, Price 2.99
var row2:Array = [4, 9.99]; // Quantity 4, Price 9.99
var row3:Array = [1, 59.99]; // Quantity 1, Price 59.99[code]....
When I test the movie the output panel displays NaN instead of 117.89.
View 2 Replies
Dec 16, 2004
I am trying to get the length of arrays within an array, here is my example (MX 2004):
[Code]...
I get an output of of 3. the number of variables within the first array, this is not what I had expedted.
View 2 Replies
Sep 26, 2011
Long story short: I want to search a multidimensional array in AS3 for (in this example) the location of 6 strings - all of which are stored in another unrelared array. Long story long: Once I get the locations (in the multidimensional array) of each string, i then know where it's located, and can access other atributes of that object - so if i found the string "box3" is located in element [5] of my multidimensional array, i can now target: multiArray[5][3] to return the 4th item stored (keeping in mind we're starting from 0, so 3 is the 4th position).
I can get this to work once, but I'm trying to set up a for loop based on the length of my basic string storage array - this array holds (in this example) 6 instance name strings - each time my for loop loops, i need to run a search in my multdimensional array for the next consecutive instance name. Then, once I've located all of them (and store the results in a new temporary array) I can dig around in each location for the info I need.
[Code]...
View 3 Replies
Nov 12, 2009
I have a class in which I have declared an array. The functions in that class are designed to make changes to the array, but it's not working:
[Code]...
Anything I do to customerCheck treats it as if it were a new array. This is especially obvious when using customerCheck.push in addCharToCheck() -- the trace always shows a blank array before push and an array with one object in it after the push... then next time it does the same. I know I'm making some sort of fundamental error regarding the scope of the array within the class but I just cannot find any good information on how to fix it! Moving to AS3 (been coding it for all of about 3 weeks) is a nightmare so far, and it seems to be the 'easy' stuff that causes me problems
View 6 Replies
Jan 21, 2011
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.
View 1 Replies
Aug 26, 2009
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.
View 5 Replies
Sep 26, 2011
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.
View 3 Replies
Feb 17, 2009
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() );
[code].......
View 8 Replies
Dec 27, 2009
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.
View 7 Replies