views:

32

answers:

2

Just wondering, is it possible to limit number of 'imports' in AS3 code by defining them in parent class or in any other way?

Thanks in advance

+1  A: 

I wouldn't recommend it but you can use #include to include a standard set of imports (or any AS3 code).

Also you can use import com.whatever.* to import by package instead of class.

Sam
+1  A: 

I would say that you shouldn't worry about it! It doesn't matter how much import statements you have. If you need to use the classes, then you need to import them.

A good IDE (e.g. FlashDevelop) will manage your imports anyway, so you don't even need to think about it.

I personally think (and I am sure that a lot of programmers would agree) that you should hide/obscure how a system works from yourself. It should be obvious what is going on, and not "weird". Stick to the best practices, which is having your imports at the top of your class.

TandemAdam
Thanks for the answer, it just became too much imports in the top of the file, and they are pretty much the same for, say, visual classes...
artvolk
I don't think you should worry about having "too many classes". Hiding your dependencies is much worse! If your are using FlashDevelop or FlashBuilder, you can always collapse your imports.
TandemAdam