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]
** *** 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:
Good luck.