# Accessing function outside static function

**URL:** <https://forum.kirupa.com/t/accessing-function-outside-static-function/278126>\
**Category:** flash\
**Created:** [December 22, 2008, 7:43pm UTC](https://forum.kirupa.com/t/accessing-function-outside-static-function/278126 "2008-12-22T19:43:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbdvd7](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@dbdvd7](https://forum.kirupa.com/u/dbdvd7)\
**Post date:** [December 22, 2008, 7:43pm UTC](https://forum.kirupa.com/t/accessing-function-outside-static-function/278126/1 "2008-12-22T19:43:10Z")

</div>

Im passing variables between classes using a static function. Like so:

```auto

//Main.as
...
Index.location(info);

...
//Index.as

public static function location(info:Number):void
{
     info = city;
     loadXML();
}
public function loadXML():void
{
....

```

when I do this I get the error: Call to possibly undefined method loadXML. Now if I set the city var and loadXML function to static also, I get no error and it works, but what I am wondering is if this is:  
a) the best practice, im guessing not  
b)how do I access these fucntions, var, etc without making them all public static?  
c)best practice to deal with this situation

Thanks in advance
