# Working with functions in external as file

**URL:** <https://forum.kirupa.com/t/working-with-functions-in-external-as-file/315320>\
**Category:** flash\
**Created:** [October 22, 2010, 9:17pm UTC](https://forum.kirupa.com/t/working-with-functions-in-external-as-file/315320 "2010-10-22T21:17:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toelli](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@Toelli](https://forum.kirupa.com/u/Toelli)\
**Post date:** [October 22, 2010, 9:17pm UTC](https://forum.kirupa.com/t/working-with-functions-in-external-as-file/315320/1 "2010-10-22T21:17:53Z")

</div>

Hello …

Im trying to understand alittle more about using external files.

In my flash actionscript window i basicly want to access a function that i wish to put in an external .as file … but i just cant seem to get it…

like:

```auto
myFunction();

```

in external file

```auto
function myFunction() {
   trace("test");
}

```

I’v been trying some code but it dont work very well…  
(myClass.as)

```auto
package {
   public class myClass{
      public function myClass() {
         trace("test");
      }
   }
}

```

and in my flash file the only way for it to trace was if i wrote:

```auto
var test:myClass = new myClass();

```

But i dont get it … how can i access the function form wherever i want … so i basicly can type myClass() and it traces again … i dont wanna create variables to run the functions … i hope you understand and i hope/suppose its probably very basic…

I prolly got it all wrong… i’v tryd to figure out if i can/should access it with import instead… but dident get that to work either…
