ActionScript 3.0 :: Using Multidimensional Arrays - Correct Move Onto The Next Level
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
Similar Posts:
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
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
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
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
May 1, 2010
Code:
thumb03.onRelease = function(){
image_holder.loadMovie("images/03.jpg");
submenu01_holder.attachMovie( "submenu01", "submenu01_new",this.getNextHighestDepth());
getURL("./htm/03.html", "tracker");
};
So I'm working on a portfolio and I'm trying to load an image with a submenu on top of it that will let you click through a couple different related images. However, right now the submenu keeps loading underneath the image, so the buttons are there and you can see it a split second before the other image loads over the top. I tried manually putting in levels for the image and submenu and no luck.
View 4 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
Apr 14, 2010
I'm new to Actionscript 3.0 and flash and I'm trying to make a simple drag and drop project that using externalinterfacecall will have javascript check or uncheck a value on a webpage when an image is dropped into a certain box. I'm trying to give myself a solid string to pass through to the javascript however when I do this one way, I get a stack overflow that is as follows :
Actionscript Code:[code]........
View 3 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
Jun 2, 2008
I'm trying to develop a game that will use sound to move an mc. I want to be able to store where the level of the sound bar is after 3 seconds. Depending on how loud the player shouts the more power they will get.This is what I have so far:
// set up microphone object
_root.createEmptyMovieClip("myAudio", 1001);
_root.myAudio.attachAudio(Microphone.get());[code].....
View 3 Replies
Dec 19, 2010
how to animate a piston like the one above in flash cs5? Should I use bones? if so how? At the moment the only way I can see to do it is to step through one frame at a time and move the linkage rod and piston into the correct posistion.
View 2 Replies
Jan 25, 2010
I have clips on stage named: bean_1,bean2, bean3.I have an array to reference the clips: moveBeansArray[bean_1,bean_2,bean_3]I have an array that stores _x co-ordinates: xPosArray[200,250,300]I then have a function to move a clip via a flag variable: movebeans.[code]
View 6 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
Dec 20, 2006
This is probably one of several ways to do this..."myData" is an array that contains information displayed in "myDataGrid". "toBeMoved" is a variable containing, um, the item to be moved.
btn_up.onRelease = function() { // this is a button to move items UP in the list
whoseSelected = myDataGrid.selectedIndex; // gets the index # for the selected row/item
if (whoseSelected > 0) { // makes sure you dont have the already top item selected
toBeMoved = myData[myDataGrid.selectedIndex][code]...
View 2 Replies
Dec 30, 2009
I'm trying to get the depths of all the blocks to be at the correct levels at the correct times so that the 3d effect is maintained. I've tried many things, but have had little success. All the instances of the blocks are stored in an array, but since it's adding them in accordance with when they're added to the stage, it doesn't help me locate them to swap depths. Is there a way to arrange them by location on the board?
View 4 Replies
Apr 22, 2011
im trying to create a level select screen so the buttons unlock as you complete a level, so far i have this on each button:
on(release){
if(this.number <= currentItem){
gotoAndPlay(3);
}
}
[Code]...
View 0 Replies
Aug 26, 2010
I have two layers in my FLA both with empty movie clips as follows:In mc_Empty1, I attach a faded background movieclip as I wait for mc_Empty2 to load a SWF. Once the SWF is loaded into mc_Empty2, I want to remove the faded background movieclip from mc_Empty1. When I load the SWF from the main timeline, the onLoad() function works and removes the faded background from mc_Empty1. However, when I load the SWF from mc_target, the SWF loads, but the onLoad() function does not. Here's my AS2 code:
//Loading SWF from main timeline
mc_Empty1.attachMovie("mcFadedBg", "mc_FadedBg", 1);
mc_Empty2.loadMovie("My.swf");mc_Empty2.onLoad = function():Void{ trace("loaded"); //This works removeMovieClip(mc_Empty1.mc_FadedBg); //This works}
[code]....
I know I'm targeting properly because the SWF loads as it should, but the onLoad() function does not.
View 3 Replies