I usually work with many AS files in the same folder and it is easy to address those files to each other. But I now have a sub folder inside the name folder which stores most of my files; and there is another as file inside that sub folder. How can I change variables of the AS file(inside the sub folder) from the AS files from the main folder and vice verses. Thank you a lot ^^
Share
You probably need to use the
importkeyword if I’ve understood your question correctly. ActionScript files that reside in the same folder are automatically visible to each other, but files in different folders need to be imported. For example:In this structure,
acan accessb(and vice versa) because they are in the same folder, or package. Neitheranorbcan accessc, becuase it is in a different package (name.sub), and likewiseccannot accessaorb.To make
aable to accessc, you must import the file first, like this:Notice that
aresides.asis omittedThe same would be done to allow
cto accessa:And as a bonus, if you want to import all the files in a package you can use a wildcard selector:
Edit: As Taurayi notes in the comments, correct naming convention is to use lowercase names for folder/package names and to capitalize file/class names, e.g.
com.myproject.components.MyComponentClass