multidimensional array

Hi I am trying to create a 3 x 3 matrix

When I run my code, the result is a black_mc which is the first and the rest is not displayed. Can someone point out to me my error pls.

Thanks in advance

var black_mc:Black;
var white_mc:White;

var tiles: Array = new Array (new Array(black_mc,white_mc,black_mc), new Array (white_mc, black_mc, white_mc), Array (black_mc, white_mc, black_mc)) new;

for (var i: int = 0; i < 3; i ++) {}
for (var j: int = 0; j < 3; j ++) {}
If (tile [i] [j] == black_mc) {}
black_mc = new Black();
black_mc.x = black_mc.width * j;
black_mc.y = black_mc.height * i;
stage.addChild (black_mc);
} ElseIf (tile [i] [j] == white_mc) {}
white_mc = new White();
white_mc.x = white_mc.width * j;
white_mc.y = white_mc.height * i;
stage.addChild (white_mc);
}
}
}

I'm not really sure of the problem, if someone else can weigh in on it, but I think it has to do with the help of instance names in the table.  I think about it a little more in all cases.  Try instead the following...

var black_mc:Black;
var white_mc:White;

var tiles: Array = new Array (new Array ("black_mc", "white_mc", "black_mc"), new Array ("white_mc", "black_mc", "white_mc"), new Array ("black_mc", "white_mc", "black_mc"));

for (var i: int = 0; i<3;>
for (var j: int = 0; j<3;>
If (tile [i] [j] == "black_mc") {}
black_mc = new Black();
black_mc.x = black_mc.width * j;
black_mc.y = black_mc.height * i;
stage.addChild (black_mc);
} ElseIf (tile [i] [j] == "white_mc") {}
white_mc = new White();
white_mc.x = white_mc.width * j;
white_mc.y = white_mc.height * i;
stage.addChild (white_mc);
}
}
}

Tags: Adobe Animate

Similar Questions

  • Table of elements - multidimensional arrays

    Need:

    I need a multidimensional array that I want to use through several workflow.

    Detail:

    The information for each of the 10 + child tables are attributes of static information of VC:objects as VC:sdkconnection, VC:DatacenterFolder, VC:NetworkFolder, VC:Datacenter, etc.

    Direction:

    My idea was to create a configuration for each of the table element.  Then, create a Parent Configuration element with an attribute type of elements in the Configuration table.  To test this I wanted to make one for each loop through the array of items.

    System.log("Total Number of array objects: " + ParentElement.length);
    for(var i=0; i<ParentElement.length; i++){
      System.log("Total Number of array objects name " + ParentElement[i].name);
      System.log("Total Number of array objects: " + ParentElement[i].length) 
    }
    

    I managed to print the names of the child element objects.

    I have been unsuccessful in obtaining listing attributes in the child objects.

    in the above code ParentElement [i] .length is undefined.

    Advice/guidance is appreciated.

    Even if your solution does not work, it gives me a new direction.  And ultimately a solution.  Without identifying each brick on the yellow brick road, here's what I came with.

    1. I moved all configuration items in a folder to create a category

    2 pulled all the elements (previous method began with an attribute of the element to set up an array of elements).

    3. by looping through the items looking for a match in the entry workflow a string to index into the items attribute

    4. once found populate the output of the workflow with the objects identified in this configuration item.

    It was exactly what I was looking for when I started this thread, but it gives me a dynamic solution for future growth.  If I need to extend my environment, I can do this simply by adding another element of configuration category and revisits not 100s of workflows.

    Thank you for your quick response, the expertise and the entrance.

    var class = Server.getConfigurationElementCategoryWithPath (categoryPath);

    If (category == null) {}

    throw "CI" "" + categoryPath + "' not found!";

    }

    var category.configurationElements = items;

    for (i = 0; i< elements.length;="" i++)="">

    If (elements [i] .name! = null) {}

    var attribute is elements [i] .getAttributeWithKey ("indexCode");.

    indexCode = attribute.value;

    If (attribute! = null) {}

    If (attribute.value == inputCode) {}

    attribute = elements [i] .getAttributeWithKey ("vc_sdk");

    vc_sdk = attribute.value;

    attribute = elements [i] .getAttributeWithKey ("vc_Datacenter");

    vc_Datacenter = attribute.value;

    attribute = elements [i] .getAttributeWithKey ("vc_hostsFolder");

    vc_hostsFolder = attribute.value;

    attribute = elements [i] .getAttributeWithKey ("vc_NetworkFolder");

    vc_NetworkFolder = attribute.value;

    attribute = elements [i] .getAttributeWithKey ("vc_DatastoreFolder");

    vc_DatastoreFolder = attribute.value;

    break;

    }

    }

    }

  • Multidimensional array in Indesign?

    Hey guys,.

    normally in javascript, I can just create a multidimensional array as follows:

    myArray = [[]];

    and then assign values like this:

    myArray [0] [0] = 'item1 ';

    Extendscript I get the error "undefined is not an object. Is there something I forgot, or is it simply not possible in Indesign?

    I discovered that it was another problem. The code works like this, but you define how many berries at the beginning is in the table. Otherwise, it will throw the error "undefined".

    points = new Array (object.paths.length);

    for (i = 0; i

    points [i] = new Array();

    }

    This code now works as well as the length of the array exactly the length you need. And for all keys, you add another table, to create your two dimension table on all the keys.

  • AS3 multidimensional array

    Hello.

    I am new to AS3. I would like to know how I can create a multidimensional array (eg. 8 x 8) with for, or while. The values it takes only: red, blue, green, yellow and black.

    Thank you.

    If you want to choose the colors randomly, place them in a table and to randomly select one of them by using the methods of mathematics...

    var colorArray:Array = new Array ("red", "blue", etc...)

    for (var i: int = 0; i<8;>

    mArray [i] = new Array();

    for (var k: int = 0; k<8;>

    mArray [i] .push (colorArray [Math.floor (Math.random () * colorArray.length)]);

    }

    }

  • Multidimensional arrays in apex

    There of multidimensional arrays in apex? I want to do is to display information in a table with 3 items... As a matrix

    I don't think it's possible in the APEX. APEX mapping has been implemented by AnyChart www.anychart.com.
    Oracle has not approved all types of graphics available in the Solution of AnyChart. Check here if they have multidimensional mapping solutions. You must purchase a license for the use of comprehensive charting solutions.

    Thank you
    Mehabub

  • Generate multidimensional array strings

    I'm generating strings by concatenating the columns of multidimensional array. Let us look at this table. This table has actually 1000 rows and columns of 1000. It contains integers. I need to generate many strings by concatenating the columns for all rows. In this way I put it in a loop for. But my problem is that there are so many columns that I am not able to write these by hand because the number of columns to generate concatenated string has not been set and the number of columns to concatenate is returned by getNumberOfStringComponents().
    for(int i=0;i<array.length;i++){
    if(getNumberOfStringComponents()==1){
    string1=array[0];}
    else if(getNumberOfStringComponents()==2){
    string2=array[i][0]+"-"+array[i][1];}
    else if(getNumberOfStringComponents()==3){
    string3=array[i][0]+"-"+array[i][1]+"-"+array[i][2];
    //...
    else if(getNumberOfStringComponents()==1000){
    string1000=array[i][0]+"-"+array[i][1]+"-"+array[i][2]+"-"+......+"-"+array[i][999];}
    }
     
    As you see it is very inefficent to write string1000 because it needs  much manual processing. Could you suggest any good algorithm for composing these 1000 strings without writing if statement with 1000 branches by hand.
    
    Edited by: totalnewby on May 19, 2011 3:54 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    See http://download.oracle.com/javase/tutorial/java/nutsandbolts/for.html
    and http://download.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html

  • How can I control mouse click event (properly) in a multidimensional array?

    Hi all!

    I have a question about the use of the events of mouse clicks in a multidimensional array (or a '2D' table that we refer to them in Java and C++).

    Background

    I have an array of objects of each with a corresponding mouse click event. Each object is stored in a place between [0] [0] and [5] [8] (so a 9 x 6 grid) and has the specific column and thus associated line number (i.e. tile [2] [4] has a 2 line number and a column 4 number, even if it's on the third row, fifth column). With each click of mouse, the tile that is selected is stored in a temporary table. Table is disabled if a tile is clicked that is not a value line or column equal to, less than or more 1 with the currently targeted tile (i.e. clicking tile [1] [1] clears the table is there are no stored tiles bearing the number of row/column)

    [0] [0] [0] [1] [0] [2],

    [1] [0], [1] [1], [1] [2],

    [2] [0] [2] [1], [2] [2]

    (or any column/line contiguous with another tile stored in the array, which means that the newly selected tile must only be sharing a border with one of the tiles of the temp table but not necessarily with the last tile stored).

    Question

    What is somehow clean and tidy this programming in AS3? Here are some parts of my code (although the mouse click event is not finished/working correctly):

    service public tileClick(e:MouseEvent):void
    {
    var tile: Object = e.currentTarget;

    tileSelect.push (uint (tile.currentFrameLabel));
    selectArr.push (tile);

    If (tile.select.visible is false)
    {
    Tile.Select.Visible = true;
    }
    on the other
    {
    Tile.Select.Visible = false;
    }
    for (var i: uint = 0; i < selectArr.length; i ++)
    {
    If ((tile.rowN == selectArr [i].rowN-1) |)
    (tile.rowN == selectArr [i] .rowN).
    (tile.rowN is .rowN selectArr [i] + 1))
    {
    If ((tile.colN == selectArr [i].colN-1) |)
    (tile.colN == selectArr [i] .colN).
    (tile.colN is .colN selectArr [i] + 1))
    {
    trace ("jackpot!" + i);
    }
    }
    on the other
    {
    for (var ii:uint = 0; ii < 1; ii ++)
    {
    for (var iii:uint = 0; iii < selectArr.length; iii ++)
    {
    selectArr [iii].select.visible = false;
    }
    selectArr = [];
    trace ("Err!");
    }
    }
    }
    }

    so, no matter what tiles are clicked, you only added to selectArr?  That is to say, if someone clicks on tiles randomly contiguous or not, what they added to selectArr?  If so, let the way you have it but change contigF().

    If you want to add a tile of selectArr if selectArr is empty, and when the user click on a tile adjacent selectArr, move the push() method to run If contigF() returns true and change contigF() to:

    function contigF(tile:DisplayObject):Boolean {}

    {if(selectArr.Length==0)}

    Returns true;

    }

    for (var i: int = 0; i<>

    if(Tile!=selectArr[i]&&math.) ABS (selectArr [i] .rowN - Tile.rowN)<2&&Math.abs(selectArr[i].colN><>

    Returns true;

    }

    }

    Returns false;

    }

  • question about multidimensional array

    Hello

    I'm trying to figure out how to generate a table whose elements are each tables to make a database of fast loading of all kinds.

    the main table essentially would be something like "employees" while each employee would have given demographics such as age, sex, salary, etc.

    In some cases, information on certain employees would be superior to others, and options created by 'push' would involve the number of

    elements in each employee table would be variable up to this that generated.

    I noticed multidimensional array Setup

    table = new array (new array("A","B"), new array("C","D"));

    and accessible using the

    table [n] [m]

    But I feel that this type of table as it is currently described does lend itself well to adding new elements in the way I described.

    My goal is once the employee information has been entered and saved, I can call their table as aEmployee number information [2], and if the employee of the 2 name is Bob, then name of Bob appears in the text field, as well as all the other fields associated with Bob Bay, for example, be a man 42 and living in Witchita Kansas.

    "I change a multidimensional array, or what I want a table in a table, and is it possible to add a" matrices "as elements?

    you have a misunderstanding of basic objects. and your enterframe loop should be deleted.  What purpose do you think it is?

    the name of your object (like shelley) is irrelevant.  you will never use the name of the object, because they are all missing stored in and you're going to refer to them by index number in one.

    If you want to retrieve the data associated with a person with shelley namaewu, use the following:

    function findPerson(namaewuS:String):Object {}

    for (var i = 0; i)<>

    {if(aPerson[i].namaewu==namaewuS)}

    missing return [i];

    }

    }

    }

    Look at the code I gave in my previous message.

  • Statement global multidimensional array

    How no one declares a multidimensional array global?
    [] [] _Global.imageArray doesn't seem to work.

    Thanks for any help

    :

  • How to create a multidimensional array constant?

    I have a code where I'm trying to mathematically manipulate tables in a while loop. I was counting on multiplying one table by a constant, but on the second iteration the constant actually eventually change to an array of different constants *. So, I would define an array of constants to a single value. I did it using the 'constant matrix. I stuck a double constant Interior point and wired it me terminal. A problem I have is that the size of the array is not matching my another Bay. In the box to the left of my constant value double point, I put in '10' because the size of the table I want is 10. Instead of generating a table of 10 elements with all the same constant, it created... uh... nothing. I received null: []. What I am doing wrong?

    Then, is it possible to set the length of this array based on the length of another table? For example, the table I want to work with that is 10 items, but it may not ALWAYS be 10 items. I would like to put in some flexibility so that if it passes 30 items, the constant table that I create will be smart enough to know that it must also be an array of 30 items.

    In addition, I apologize to not include an image. The computer with LabVIEW is not the same as the computer connected to the internet. Promote my frustration, the only way I can transfer data from this computer translates into encrypted data unless I have to burn a CD. Oh working for the federal Government is sometimes a treat.

    * The constant becomes a table of constants because the process is iterative. I start with an estimate of the constant, but then this assumption is updated by the values in the table, forcing him to become a table itself.

    And if you really want to continue to use berries, yes there is a way to make the length of you table identical to the length of another table.

    Here is an example with a 2D array:

    -Table is the original array

    -10 is the constant which acts as the multiplier

  • How can I create multidimensional arrays of controls?

    I build a VI that will have hundreds of power keys, 24 on each of the 8 tabs.  I can deal with them programmatically in an array, like this:

    and to find one that was pushed with some XOR'ing:

    But what happens if I want two rows of 12 buttons?  I can make a 2D buttons somehow?  Or a table 1 d of buttons on two lines for aesthetic reasons?

    What happens if I want to put 24 buttons on each of the 8 tabs?  Can I make a table of 24 x 8 controls somehow?  Or a 2 x 12 x 8?

    Thank you

    -Jordan

    Right click on the display of the Index and Add Dimension.

    I would be cautious to put too many buttons. Makes for an awkward interface.

  • With an average of lines in a multidimensional array

    I have a file (file1.dat) that is created using the 'write on the worksheet file vi', that writes the output of a photo detector. Experience a try N. Each test gives a table 1 d M number of data as a column. Once the experience complete, the file will contain N columns and rows of Mr. I'd like to find the average of each line in labview. The output (file 2.dat) should be a column of M elements, each element being the average of the N data contained in one line. Treatment in excel or origin is not possible. Generally, > 10000 and N > 100 M. Can help? For example:

    file 1.dat:

    A1 B1 C1

    A2 B2 C2

    A3 B3 C3

    A4 B4 C4

    File 2. dat must be:

    (A1 + B1 + C1) / 3

    (A2 + B2 + C2) / 3

    (A3 + B3 + C3) / 3

    (A4 + B4 + C4) / 3

    Thank you!

    If everything you have in the database without headers or footers, it should be fairly simple.  Look at this:

    -Kevin P

  • Temporary Tables vs. two multidimensional arrays

    Dear gurus,

    We have an obligation to perform a loop on a few thousand lines and do some calculations complex (to do in PL/SQL cannot be through simple SQL). These lines came out of a long running query dealing with millions of rows.

    Now the question - our team is to have a confusion if we need to use a temporary table or tables in two dimensions.

    We tried both ways and right now, there seems to have not much of a difference in processing times. (I know it's not good to be based solely on the processing time, especially when it is just a test environment - not as much data as in production, diiferent server,...)

    Could you gurus please thow shed some light on this? The use of memory other resources the same in both cases?

    Thanks in advance.

    884476 wrote:

    TWG is also private, no data?

    Definition of static, private data. Like object class which is public, and all objects instantiated from this class exist in the code that builds the object.

    Where should it be stored? In the files of data - or PGA?

    No PGA. Oracle will use the temp space (shareable) database.

  • How to make reference to the multidimensional array element?

    What should I change in the next statement in the dbms_output to display 'Ken' and avoid the error?

    Thank you
    -Ken
    create or replace type kja_person_name_rec as object
    ( pena_id number(10)
    , pers_id number(10)
    , pnty_cd varchar2(10)
    , first_nm varchar2(100)
    , family_nm varchar2(100)
    );
    /
     
    Type created
    create or replace type kja_person_name_tbl as table of kja_person_name_rec not null;
    /
     
    Type created
    create or replace type kja_person_rec as object
    ( pers_id number(10)
    , birth_dt date
    , person_names kja_person_name_tbl
    );
    /
     
    Type created
    create or replace type kja_person_tbl as table of kja_person_rec not null;
    /
     
    Type created
    declare
      l_person_name  kja_person_name_rec;
      l_person_names kja_person_name_tbl;
      l_person       kja_person_rec;
      l_persons      kja_person_tbl;
    begin
      l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
      l_person_names := kja_person_name_tbl( l_person_name);
      l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
      l_persons      := kja_person_tbl( l_person);
     
      dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
    end;
    /
     
    declare
      l_person_name  kja_person_name_rec;
      l_person_names kja_person_name_tbl;
      l_person       kja_person_rec;
      l_persons      kja_person_tbl;
    begin
      l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
      l_person_names := kja_person_name_tbl( l_person_name);
      l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
      l_persons      := kja_person_tbl( l_person);
    
      dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
    end;
     
    ORA-06550: line 13, column 80:
    PLS-00302: component 'FIRST_NM' must be declared
    ORA-06550: line 13, column 3:
    PL/SQL: Statement ignored
     
    SQL> 

    Hello

    Ken Anderson says:
    What should I change in the next statement in the dbms_output to display 'Ken' and avoid the error?

    Thank you
    -Ken

    create or replace type kja_person_name_rec as object
    ( pena_id number(10)
    , pers_id number(10)
    , pnty_cd varchar2(10)
    , first_nm varchar2(100)
    , family_nm varchar2(100)
    );
    /
    
    Type created
    create or replace type kja_person_name_tbl as table of kja_person_name_rec not null;
    /
    
    Type created
    create or replace type kja_person_rec as object
    ( pers_id number(10)
    , birth_dt date
    , person_names kja_person_name_tbl
    );
    /
    
    Type created
    create or replace type kja_person_tbl as table of kja_person_rec not null;
    /
    
    Type created
    declare
    l_person_name  kja_person_name_rec;
    l_person_names kja_person_name_tbl;
    l_person       kja_person_rec;
    l_persons      kja_person_tbl;
    begin
    l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
    l_person_names := kja_person_name_tbl( l_person_name);
    l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
    l_persons      := kja_person_tbl( l_person);
    
    dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
    end;
    /
    
    declare
    l_person_name  kja_person_name_rec;
    l_person_names kja_person_name_tbl;
    l_person       kja_person_rec;
    l_persons      kja_person_tbl;
    begin
    l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
    l_person_names := kja_person_name_tbl( l_person_name);
    l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
    l_persons      := kja_person_tbl( l_person);
    
    dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
    end;
    
    ORA-06550: line 13, column 80:
    PLS-00302: component 'FIRST_NM' must be declared
    ORA-06550: line 13, column 3:
    PL/SQL: Statement ignored
    
    SQL> 
    

    L_persons (1) .person_names is a kja_person_name_tbl. Kja_person_name_tbls is not first_nms; only kja_person_name_recs do.
    Near the end, instead of

       dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
    

    Try

    dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names(1).first_nm);
    --                                                                   added  ^^^
    
  • Built-in sort with Arrays.sort

    I have multidimensional array that contains a number as new arr int [10] [10] and that you want to sort according to the last column. Arrays.sort is a simple way to do it, but what happens if I don't want a real movement elements occur by Arrays.sort (arr [] []). Frankly, I'm interested in winning positions but not to grant the lines. Can I pass it arrange step because not interested in changing the original table? For the moment, I sort the table with Arrays.sort then index of table row and I fixed the position number pair. For example arr [0] has rank 1, arr [1] has the rank of 2 etc. If sorted according to the last column.

    Published by: totalnewby on May 23, 2011 22:51

    totalnewby wrote:
    I just need to know where the items would be positioned if they have been sorted. I made copy of the table at the moment and my program is successful, even if it takes a lot of time and additional memory to perform the copy because this table has billions lines in reality. If you can suggest less time-consuming solution do let me know.

    This is my standard example of how to do this sort of indirect.

     public static void main(String[] args) throws Exception
        {
            final Words words = new Words("/usr/share/dict/words");
            final List data = new ArrayList();
            for (int i = 0; i < 10000; i++)
            {
                String[] row = new String[10];
                for (int j = 0; j < row.length; j++)
                {
                    row[j] = words.getRandomWord();
                }
                data.add(row);
            }
    
            final Integer[] indirectIndex = new Integer[data.size()];
            for (int i = 0; i < indirectIndex.length; i++)
            {
                indirectIndex[i] = i;
            }
    
            final Comparator indexComparator = new Comparator()
            {
                @Override
                public int compare(Integer left, Integer right)
                {
                    int result = 0;
                    for (int i = 0; result == 0 && i < data.get(left).length; i++)
                    {
                        result = data.get(left).compareTo(data.get(right)[i]);}return result;}};
    
    Arrays.sort(indirectIndex, indexComparator);
    
    for (int i = 0; i < 100; i++){System.out.println(indirectIndex[i] + "\t" + Arrays.toString(data.get(indirectIndex[i])));}}
    
    You just need to create a Comparator for sorting the index array that uses the last entry in each row of real data array when comparing a row rather than all the row entries as I have done. 
    

Maybe you are looking for

  • Adapter Satellite M40 - 129 Centrino PM730

    Hello I have the portable 'Satellite M40 - 129 Centrino PM730' computerI need a 2nd power adapter, because I'm working on 2 places (and I'm lazy to wear)The one I have is model Liteon: PA-1750-08.(1) is the only model that works, and that another one

  • VLM can disconnect a user-based license?

    Currently, we use licenses based on computer for our products.  For some of our users who work disconnected, we eat two licenses.  We are therefore contemplate pass them to a schema license based on the user for some of our products.  I found documen

  • Windows xp sp3 corrupted/missing windows system32\config\system

    Due to the plant after installing sp3, I got the message: "windows has not start because the following file is mising or corrupted \windows\system32\config\system." Then, I preformed another destructive restore. again, had the same message. Instead o

  • Connection problems with WUSB300N and E4200

    Hello I wonder if someone can help out me. I bought an E4200 router to replace my old WRT150N. I got a WUSB300N connected properly to the old router, but it does not connect to the E4200. I have a guest network set up on this subject, and the adapter

  • Debugging and telnet

    I used telnet to access my Pix. When I run the debug command, no debug information is displayed. Why is this?