Skip to main content
Participant
October 3, 2006
Question

Errors in compilation

  • October 3, 2006
  • 10 replies
  • 1020 views
I'm a newbie in Flash.
I met some compilation errors and hope one can help.

I used Flash 8 professional.
My FLA file involves a few AS files e.g. btn_Down.as. <--- Please see the code attached
When I compiled, all the errors are concerning "ActionScript 2.0 class scripts may only define class or interface constructs."
Please help. Thanks.

Here are the errors:

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.val = 1;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 4: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.ovr(_root.Val);

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 6: ActionScript 2.0 class scripts may only define class or interface constructs.
var pageWidth = 1320;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 7: ActionScript 2.0 class scripts may only define class or interface constructs.
var pageHeight = 938;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 8: ActionScript 2.0 class scripts may only define class or interface constructs.
var cnt:Number = 0;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 10: ActionScript 2.0 class scripts may only define class or interface constructs.
var ratioX:Number = 0.12;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 11: ActionScript 2.0 class scripts may only define class or interface constructs.
var ratioY:Number = 0.12;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 13: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.mouseSensor = true;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 14: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.goDest = false;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
};

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.val = 1;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 4: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.ovr(_root.Val);

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 6: ActionScript 2.0 class scripts may only define class or interface constructs.
var pageWidth = 1060;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 7: ActionScript 2.0 class scripts may only define class or interface constructs.
var pageHeight = 480;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 8: ActionScript 2.0 class scripts may only define class or interface constructs.
var cnt:Number = 0;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 10: ActionScript 2.0 class scripts may only define class or interface constructs.
var ratioX:Number = 0.12;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 11: ActionScript 2.0 class scripts may only define class or interface constructs.
var ratioY:Number = 0.12;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 13: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.mouseSensor = true;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 14: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.goDest = false;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
};

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.val = 1;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 4: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.ovr(_root.Val);

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 6: ActionScript 2.0 class scripts may only define class or interface constructs.
var pageWidth = 1320;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 7: ActionScript 2.0 class scripts may only define class or interface constructs.
var pageHeight = 938;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 8: ActionScript 2.0 class scripts may only define class or interface constructs.
var cnt:Number = 0;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 10: ActionScript 2.0 class scripts may only define class or interface constructs.
var ratioX:Number = 0.12;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 11: ActionScript 2.0 class scripts may only define class or interface constructs.
var ratioY:Number = 0.12;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 13: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.mouseSensor = true;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 14: ActionScript 2.0 class scripts may only define class or interface constructs.
_root.goDest = false;

**Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
};
This topic has been closed for replies.

10 replies

kglad
Community Expert
Community Expert
October 5, 2006
post a link to your .as and .fla files.
billywhyAuthor
Participant
October 5, 2006
Thanks for the replies from all of you.

To be honest, all the FLA and AS are from someone.
I'm sure the they are correct and it needs not to change anymore.

However, I need to edit some animation in the flash.
Unfortunately, before editing, I tried to compile but I failed.

Because I can't contact with that person anymore, I need to work out myself.

It seems something other than the FLA and AS which cause the errors.
Is there any procedures in compilation which I may neglect?
Inspiring
October 4, 2006
I tried this code and wont find any error. it may that your .fla file has corrupted.
// --- btn_Down .. ------------------------------------------------------------

_root.val = 1;
_root.ovr(_root.Val);

var pageWidth = 1320;
var pageHeight = 938;
var cnt:Number = 0;

var ratioX:Number = 0.12;
var ratioY:Number = 0.12;

_root.mouseSensor = true;
_root.goDest = false;

this.btn_Down.onEnterFrame = function () {
trace("working ")
cnt++;
if(cnt%2 == 0) { // %翱骯濠蒂 檜辨 enterFrame擊 fps / 4
if (_root.mouseSensor) {
destX = pageWidth / 2 + (pageWidth / 2 - _xmouse) * ratioX;
destY = pageHeight / 1.5 + (pageHeight / 2 - _ymouse) * ratioY;

dX = destX - this._x;
dY = destY - this._y;
this._x = this._x + dX * 0.1;
this._y = this._y + dY * 0.1;
}

if (_root.goDest) {
dX = destX - this._x;
dY = destY - this._y;
if (Math.abs(Math.round(dX)) == 0 && Math.abs(Math.round(dY)) == 0) {
_root.goDest = false;
}
this._x = this._x + dX * 0.200000;
this._y = this._y + dY * 0.200000;
}
}
};

// ------------------------------------------------------------------------------
make sure your "btn_Down" is a movieClip and you are not using ";"
after #include "btn_Down.as"
billywhyAuthor
Participant
October 4, 2006
Thanks for your reply.

I'm sure the code is correct and there is no other btn_Down.as.

Is there any setting which I may neglect?
kglad
Community Expert
Community Expert
October 3, 2006
there's something other than the code you've posted here causing that problem. are you sure the code for btn_Down.as is accurately posted here?

is it possible that you have two btn_Down.as files in two different directories? is your flash html and swf in the same folder? if they are in different folders, are there two different btn_Down.as files in those folders?

if you're still having problems after reading the above, post a link to your fla and your .as file.
billywhyAuthor
Participant
October 3, 2006
#include "btn_Down.as"
kglad
Community Expert
Community Expert
October 3, 2006
show your include statement. (and you can't attach files here.)
billywhyAuthor
Participant
October 3, 2006
Attached is my btn_Down.as file.
I used an include statement to load it.
kglad
Community Expert
Community Expert
October 3, 2006
do you have a btn_Down class? or are you using an include statement to load your as file?
Participant
June 24, 2019

Randomly out of nowhere the type tool stops working. It's not a particular set of steps that trigger it but anything randomly makes the type tool freeze. I have to restart the application all over again to make it work - which is as annoying as it sounds.

Please provide some help or support regarding this.

Thanks,

L

italosan
Community Expert
Community Expert
June 25, 2019

Hi, try uninstalling and installing Adobe XD again.

Inspiring
October 3, 2006

"billywhy" <webforumsuser@macromedia.com> wrote in message
news:efsrl8$sdh$1@forums.macromedia.com...
> I'm a newbie in Flash.
> I met some compilation errors and hope one can help.
>
> I used Flash 8 professional.
> My FLA file involves a few AS files e.g. btn_Down.as. <--- Please see the
> code
> attached
> When I compiled, all the errors are concerning "ActionScript 2.0 class
> scripts
> may only define class or interface constructs."
> Please help. Thanks.

How are you *including* the AS files?