2D Vector

Actionscript:
  1. var map:Vector.<Vector.<int>> = new Vector.<Vector.<int>>();
  2. map[0] = new Vector.<int>();
  3. map[0].push(1);
  4. map[0].push(0);
  5. map[0].push(0);
  6.  
  7. map[1] = new Vector.<int>();
  8. map[1].push(0);
  9. map[1].push(1);
  10. map[1].push(0);
  11.  
  12. map[2] = new Vector.<int>();
  13. map[2].push(0);
  14. map[2].push(0);
  15. map[2].push(1);
  16.  
  17. /*
  18. map:
  19. 1,0,0
  20. 0,1,0
  21. 0,0,1
  22. */

This creates a two dimensional Vector of ints (flash 10 player only). The first line is the real snippet... took me a few minutes to get the syntax right the first time I needed a 2D Vector.

This entry was posted in Vector, arrays and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*