This content has been marked as final. Show 5 replies
Wait...but then it says you can import more than one class....I am confused. If you can only make one class from a package in an external .as file available then how could you do import.samples.* to make all the classes available?
I know I am missing something here....
Here is what I am referring to: "Actionscript 3.0 allows you to include multiple classes in one source file, but only one class in each file can be made available to code that is external to that file."
Maybe some kind soul can explain to me?
Thanks in advance!
you can only CREATE or define one (new) class per as file. the (new) class must have the same name as the file name. because the file can only have one name you can only have one class defined.
code external to your class file will only use the new class. ie, you won't be able to use external code to create instances of the other classes used in your class file because they aren't created in that class file so their constructors, methods, properties etc are not in that class file. they are in their own class file.
but you can use any number of classes within your class file that contains a new class. and you can create instances of those other classes IN your class file.
Okay. So only one public class per .as file....then you have to make one external .as file per class you want to be public? I guess that isn't too bad...so all my class properties I want to be able to access outside of that external file need to be in that class...?
I'm not use to package-class-property programming structure but am getting used to it.
no external .as file is needed.
and only one public class per file. but all the classes methods and properties can be public, if you choose. and you can have many classes defined in one class file.