Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 3 of 3

Thread: Array problem

  1. #1

    Default Array problem

    Could someone check what seems to be the problem in this script.

    This example will only use one loop of the code with values:
    DD_L_Types = Plains and all other values are 0.

    Code:
    var HexInfo:Array = new Array();
    function HexaMaaritys(i, b) {
    	HexInfo[[i][0]] = DukeData_Lands_Types[b];
    	HexInfo[[i][1]] = DukeData_Lands_RiverNo[b];
    	HexInfo[[i][2]] = DukeData_Lands_RiverNe[b];
    	HexInfo[[i][3]] = DukeData_Lands_RiverSe[b];
    	HexInfo[[i][4]] = DukeData_Lands_RiverSo[b];
    	HexInfo[[i][5]] = DukeData_Lands_RiverSw[b];
    	HexInfo[[i][6]] = DukeData_Lands_RiverNw[b];
    	trace ("A"+HexInfo[i]);
    	trace ("B"+HexInfo[[i][0]]+HexInfo[[i][1]]+HexInfo[[i][2]]+HexInfo[[i][3]]+HexInfo[[i][4]]+HexInfo[[i][5]]+HexInfo[[i][6]]);
    }
    // APlains
    // BPlains000000
    So why does the HexInfo[i] only give the first item in the array?
    And how can I input data into the array so it comes out correctly?

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2

    Default

    Trace B works fine, right? I'm not really sure what the problem is. I think Trace A works fine too. Actually, in my opinion, trace A shouldn't be... really defined. Because Hex Info is a 2-dimensional array, and trace A only defines 1 dimension so...

    well, if I was a programming language, I would spit out "undefined" for trace A =p

    So what's the problem?

  4. #3

    Default solved some time ago

    Yeah, I just needed to double dimension the array and then it started working.

    Code:
    var HexInfo:Array = new Array(21);
    for &#40;a=0;a<22;a++&#41; &#123;
      var HexInfo&#91;i&#93;&#58;Array = new Array&#40;38&#41;;
    &#125;
    And I don't need the double braccets
    HexInfo[i][j] will do fine.
    So now when I trace (HexInfo[i]);
    I get all the correct data from the i:th array slot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Load all of a directory (server-side) into an array?
    By frank in forum Flash Scripting
    Replies: 1
    Last Post: 10-17-2006, 10:23 PM
  2. From an array to textbox - how do i do this?
    By MikeWire in forum Newbies
    Replies: 1
    Last Post: 07-26-2006, 04:55 PM
  3. create array an loop to verify many characters/text
    By defunkt in forum Flash Scripting
    Replies: 1
    Last Post: 04-05-2005, 07:03 PM
  4. xml database and dinamic menu from created array
    By cocas in forum Advanced Flash
    Replies: 0
    Last Post: 10-12-2004, 12:16 AM
  5. Help with viewing items in an array.
    By dchil82 in forum Newbies
    Replies: 0
    Last Post: 12-04-2003, 12:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial