Yes, you can organise your files into a hierarchy within a directory structure, then compile the project by just compiling the top level file which references the rest.
The one thing you have not mentioned is your package structure. In your main.as you would need to add a line to refer to foo, e.g.
import qux.foo
Then at the top of foo.as you need
package qux {
Repeat this for other folders, and folders within folders. A folder quz
within folder qux
would have classes in package
package qux.quz {
and a class bar
in that folder could be referenced as
import qux.quz.bar
from anywhere else in the hierarchy.