3 ways to reduce redundant code in your adobe flash actionscript 3 projects

There is 3 great ways to reduce redundant code in your actionscript 3 projects:

1) Aggregation

If objects A and B has same function, why not put that function on a separate object C and let both other objects call it from there.

2) Composition ie. inheritance

Put your redundant code to a class C and let your objects A and B inherit those methods from there.

3) Last but not least: include -statement

Sometimes good old include -statement is best way to go. Just put your code on separate file and include it where ever it’s needed. Quick, dirty and powerfull! :)

Included code doesn’t even have to be full class orĀ  function, but any usefull bit of code will do.

Leave a Reply