You can apply many of your C++ skills to your AS3 project.
There are lots of tricks. Glad you brought up putting code on the main timeline. Instead of putting code on the timeline (this is way too common in AS2 programs and with AS3 you can completely avoid it) I would recommend thinking of each object as a separate class. Your movieclip that you are applying mouseclick code to, for example, could be an object created with its own class. Say the MovieClip is a graphic of a ball. You should be creating a 'Ball' class that extends (inherits) MovieClip class, and handle the mouseclick event within it:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class myObjects.Ball extends MovieClip
{
public function Ball ()
{
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
private function mouseDownHandler(event:MouseEvent):void
{
// Code
}
}
}
Then, find your MovieClip of the ball in the Library pane, right click it, Properties, switch to Advanced mode, check off Export for AS. Now, notice how your MovieClip already references the MovieClip class as its Base Class? You won't need this any more since your Ball class extends the MovieClip class.. so in Class field write, 'myObjects.Ball' and clear the Base class field. You should see a green checkmark if you wrote a path to your namespaced Ball class that the Flash IDE can locate.
Now your Ball class will use that MovieClip so when you create a new instance of Ball in your main class, you can work with it like a MovieClip and attach it to the Stage, dynamically. Or, you could just add it in the timeline by manually dragging the Ball MovieClip on there.
Extending a class I explained is AS3's version of 'Inheritence' (Ball class inherits the MovieClip class). You can also use other OO-concepts like, polymorphism and encapsulation. You should encapsulate your code in to separate classes wherever possible. Say if you had a few different types of ball MovieClips in your project, and you want Ball class to be a parent class to Soccer ball, Pool ball, and Baseball. Each of those child classes could extend Ball class. Another thing I have found useful for large projects is to create a static class to handle all of my application's events. Since I define it as a public static class
I can import it in to each of my classes and its variables are only created once for the duration of the application. This can be extremely useful.
I have also created my own pseudo-destructor in classes in an effort to work with AS3 more like c++. The easiest way to pull this off is to call the pseudo-destructor before you destroy the instance of an object. I did make it happen automatically in one application, so if this interests anyone I can track down the code.. but AS3 handles garbage collection behind the scenes and usually a destructor is not needed, but maybe I just think it isn't needed because I developed bad habits out of programming in AS3 for too long.
Personally, I think the more you strive to develop apps in AS3 as if you are developing in C++, the more fun it gets and the more reusable your code becomes. Keep it up.. soon instead of a mess of code you will have a mess of actionscript files lol.. bit of a double-edged sword but whatevs.