# \[FMX\] #include "file.as" does not work

**URL:** <https://forum.kirupa.com/t/fmx-include-file-as-does-not-work/216806>\
**Category:** flash\
**Created:** [February 20, 2007, 7:13pm UTC](https://forum.kirupa.com/t/fmx-include-file-as-does-not-work/216806 "2007-02-20T19:13:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christoph3D](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Christoph3D](https://forum.kirupa.com/u/Christoph3D)\
**Post date:** [February 20, 2007, 7:13pm UTC](https://forum.kirupa.com/t/fmx-include-file-as-does-not-work/216806/1 "2007-02-20T19:13:54Z")

</div>

This is driving me CRAZY!  
I’m working in Flash MX (waiting to get the 8 upgrade…) and I want to write most of my actionscript in an external .as file. This file will include a bunch of functions to allow movie clips in the .fla file to act as buttons (with nifty animations on them blabla). So in the first frame of my .fla I have  
#include “myfile.as”

- I know that I cannot have a “;” in that line
- I found out that you have to include a “;” in the last line of the .as file (or an extra line break) to compensate for that
- I know my code in the .as file works because if I copy it into the main timeline, everything works fine!

Here’s the code (still testing basic functions)

[COLOR=Blue]function zoomThumbIn() {  
this.gotoAndPlay(“zoom\_in”);  
}  
function zoomThumbOut() {  
this.gotoAndPlay(“zoom\_out”);  
}

Thumb01.onRollOver = zoomThumbIn;  
Thumb01.onRollOut = zoomThumbOut;  
;  
[/COLOR]  
When running the swf, I get the following output error:  
[COLOR=Blue]myfile.as: Line 1: ‘;’ expected  
ï»¿function zoomThumbIn() {

[COLOR=Black]PLEEEZZZ HELP. Thanks [/COLOR][/COLOR]:book:

\*\* \*\*\* UPDATE \*\*\*\*\*

Solved the problem. FLash MX (v.6) still expects external .as files to be saved in ASCII format. Flash 7 & 8 switched to Unicode (UTF-8), and most external actionscript editors will automatically save in Unicode.  
**When calling an external .as file in Flash MX using #include, make sure the first line of the .as file is //!-- UTF8 if it’s saved in Unicode.** If the file is ASCII/ANSI you do not need this line.  
Here’s a link to the Adobe page regarding this issue:

> **[Adobe: Creative, marketing and document management solutions](https://www.adobe.com/?id=tn_16275)**
>
> Adobe is changing the world through digital experiences. We help our customers create, deliver and optimize content and applications.

  
Good luck. :cool:
