# Cannot access array from a function

**URL:** <https://forum.kirupa.com/t/cannot-access-array-from-a-function/331265>\
**Category:** flash\
**Created:** [June 25, 2013, 3:50am UTC](https://forum.kirupa.com/t/cannot-access-array-from-a-function/331265 "2013-06-25T03:50:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sutirtha\_Das](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sutirtha\_Das](https://forum.kirupa.com/u/Sutirtha_Das)\
**Post date:** [June 25, 2013, 3:50am UTC](https://forum.kirupa.com/t/cannot-access-array-from-a-function/331265/1 "2013-06-25T03:50:24Z")

</div>

Hi, i’m making a tile based game. There is an array which holds the Map

var myMap:Array = [[…],[…] \<-- the 2d array with numbers representing tiles

at a later function which is called by going through 2 other functions  
like begin() calls move() , and move() calls collision()

whenever i try to access the array from collision() in the form  
myMap[var1][var2] it throws this error:

TypeError: Error #1010: A term is undefined and has no properties.

However myMap[0][1] works.  
i’ve used trace to find this is the problem. And all identifiers are correct.
