Yes, working with your AS in an external editor is much better than
having it haphazardly placed in a bunch of different clips. But if you
just want to place your internal code into an external file there are a
couple things to know:
If you just want to include your code into flash, you use the #include
directive like so:
#include "mycode.as"
BUT this won't necessarily work because AS2.0 code is put into
containers called 'classes'. Flash will look in the .fla's folder for
any class files, and make sure the syntax is correct. An unfortunate
side effect of this is that if you migrate all your internal code into
an external file _in the same folder_ flash will automatically assume
you are creating an AS2.0 class. In reality you're just using normal AS
externally. This is why you're getting the erroneous error "ActionScript
2.0 class scripts may only define class or interface constructs." Flash
thinks you're making a class but you're not, because the working folder
is part of AS2's 'classpath'.
So you can either place your code somewhere else like so:
#include "../src/mycode.as"
or go into Edit->Preferences->ActionScript->Actionscript2.0 Settings and
remove the entry in the list for the '.'
C
jleonard wrote:
Appreciate the heads up. So I thought that placing as code
externally was the "more correct" way to do it. Is this not true? Or
is there another way it's done?
On Tue, 25 Oct 2005 09:21:46 -0400, Hans Wichman <[EMAIL PROTECTED]> wrote:
Hi,
an as file may only define a class as in:
class MyClass {
}
or an interface as in:
interface MyInterface {
}
Just copying your timeline code into separate files and having a
file with for example:
var myVar:String = "ffsdfsfs";
is not gonna work.
greetz
Hans
At 03:09 PM 10/25/2005, jleonard wrote:
I have just separated out my as code into different pages. The
init.as
page is now showing this error where before it worked fine. Any help
greatly appreciated...
**Error** C:\Documents and Settings\PC2005\My Documents\flash
player\init.as: Line 5: ActionScript 2.0 class scripts may only define
class or interface constructs.
var cvtvSourceVideo:String = "streams/Demo384K_Stream.flv";
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
_________________________________________
< __ __ ____ >
< | | \/ ___\ Chris Hill >
< | | / /_/ > [EMAIL PROTECTED] >
< |____/\___ / http://ubergeek.tv >
< /_____/ The Smell of Geek! >
<----------------------------------------->
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders