The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 ViewsWhile I was reading an AS3 book, there was an example of a dynamic class. I know other classes can create new vars for the dynamic class at runtime, but somehow it doesn't need to be imported in order to be used in another classes.
EX: There are two classes: one called main and another dynamic class named card. Main can use card as if it had been imported but without importing it.
Any idea of how this works?
I believe that if two classes are in the same package, they do not have to import one another. This is probably what you are experiencing.
#include <stdio.h>
char*p="#include <stdio.h>%cchar*p=%c%s%c;%cmain() {printf(p,10,34,p,34,10);}";
main() {printf(p,10,34,p,34,10);}
By same package, do you mean same folder? Because they are in the same folder but not in the same .as file...
By package I mean the package { } code that wraps around a class within a .as file.
eg:
package CustomPackage {
// class
}
You use packages to group classes together. If two classes are in the same package, they can instantiate one another without importing.
If the name of a package is omitted
package {
// class
}
It just sticks the class into a generic default package that all classes with unspecified packages go to.
#include <stdio.h>
char*p="#include <stdio.h>%cchar*p=%c%s%c;%cmain() {printf(p,10,34,p,34,10);}";
main() {printf(p,10,34,p,34,10);}
Classes of the same package must be in a folder that is named that package, unless it is the default package, in which case it is in the same directory as the .fla file.
Also, you cannot have more than one class inside a .as file
#include <stdio.h>
char*p="#include <stdio.h>%cchar*p=%c%s%c;%cmain() {printf(p,10,34,p,34,10);}";
main() {printf(p,10,34,p,34,10);}