# Not available globally?

**URL:** https://forum.kirupa.com/t/not-available-globally/296200
**Category:** Uncategorized
**Created:** [September 10, 2009, 6:45pm UTC](https://forum.kirupa.com/t/not-available-globally/296200 "2009-09-10T18:45:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ash\_at\_risk](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@ash\_at\_risk](https://forum.kirupa.com/u/ash_at_risk)
#### Post date: [September 10, 2009, 6:45pm UTC](https://forum.kirupa.com/t/not-available-globally/296200/1 "2009-09-10T18:45:24Z")

</div>

hello friends,  
i am trying to make array “carWay” elements to be available in the “function enemy\_car” but inspite of declaring it global with “public static var carWay:Array=new Array();” , i m unable to find a way where carWay array elements can be available in “function enemy\_car” Where "Race2 "is my class name.Actually i need it to develop a game for Enemy AI.Following are the lines that are causing trouble. “RaceCall” is the function that will be call inside the required .fla file actionPanel.

public function RaceCall()  
{  
this.addEventListener(Event.ENTER\_FRAME, gameloop);  
enemy\_car();  
}  
public function gameloop(event:Event)  
{  
if (lastTime==0)  
lastTime=getTimer();  
var diff:int=getTimer()-lastTime;  
lastTime+=diff;  
moveCharacter(diff);  
}  
public function moveCharacter(timeDiff:int)  
{  
Race2.carPosition=new Point(gamesprite.car.x,gamesprite.car.y)

Race2.carWay.push(carPosition);  
}  
public function enemy\_car()  
{  
trace(“carWay.length=”+Race2.carWay.length);  
}
