Sorry, I didn't understand "at the top level of a package"
This one compiled fine.
package
{
public class Test
{
}
}
var var1 : String;
Other examples:
1) compiles fine
package
{
class Test
{
}
}
var var1 : String;
function dummy():void{}
2) got compilation error
1114: The public attribute can only be used inside a package.
package
{
class Test
{
}
}
var var1 : String;
public function dummy():void{}
In the AS3.0 pdf page40, one can read:
"If you do declare
variables, functions, or namespaces at the top level of a package, the
only attributes available
at that level are public and internal, and only one package-level
declaration per file can use
the public attribute, whether that declaration is a class, variable,
function, or namespace."
I don't understand why I got the compilation error since I have only one
declaration with the public attribute.
I know it's not very funny...
Rgds,
Olivier
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Stembert Olivier (BIL)
Sent: Thursday, February 01, 2007 8:11 AM
To: [email protected]
Subject: [flexcoders] AS variables at the top level of a package
Hi again,
In the AS3.0 pdf page39, one can read:
"Many developers, especially those with Java programming backgrounds,
may choose to place only classes at the top level of a package.
ActionScript 3.0, however, supports not only classes at the top level of
a package, but also variables, functions, and even statements."
I tried to compile the following:
package
{
var var1 : String;
public class Test
{
}
}
But got the following error:
A file found in a source-path can not have more than one externally
visible definition. var1;Test
Any ideas?
Rgds,
Olivier
---------------------
An electronic message is not binding on its sender.
Any message referring to a binding engagement must be confirmed in
writing and duly signed.
---------------------
---------------------
An electronic message is not binding on its sender.
Any message referring to a binding engagement must be confirmed in
writing and duly signed.
---------------------
---------------------
An electronic message is not binding on its sender.
Any message referring to a binding engagement must be confirmed in writing and
duly signed.
---------------------