Right now I’m developing a small canvas oriented 2D graphics engine for a game, and have been looking into several sources for hints to apply to my system’s design. But obviously the most battle proven solution out there is flash, so I was wondering how is Flash architectured. I found some sources about Flash’s workings, but most are very basic and oriented towards designers and artists, but I’d like to learn more about the guts of the system. My next step is to download Flex’s source code and wade through it, but before that I’d like to have a ‘guide’ to make the best of my time in the code base. Any suggestions of good online resources and articles?
Thanks!
Edit: To make it more clear, I’m looking for the inner workings of Flash because my goal here is to make something similar to Flash, but not as powerful of course, that works in a browser without plugins. Alas pure HTML+Javascript.
Also the reason I’m not using Flash as such is because it doesn’t fulfill my requirements (free + no plugin), and because I don’t have Flash support on my target platforms, besides I’m reinventing the wheel here for fun and self-education. Oh and I already know how to use Flash 🙂
Well, at the root of your Flash content is a stage object (an instance of the Stage class). That stage is the root node of a tree of display objects, any of which can contain graphical assets (lines, text fields, etc.) or other display objects. How Flash ‘works’ is that, X times per second, the Flash player draws that entire display tree onto the screen. The player also collects user input (KeyboardEvents, etc.) from the OS and delivers them to any object that has registered for them.
Your job as a content creator, then, is to populate this Stage with children (of type DisplayObject or any subclass), which the Flash engine will draw onto the screen for you. You can populate it with low-level children like Sprite and MovieClip and TextField, which are the basic building blocks of Flash content, or you can instantiate things like ScrollBar or DataGrid, which are higher-level components with the usual complex inner workings.
And of course you can extend any of these classes to include your own custom visuals or class logic, or create non-visual classes that aren’t part of the display tree. And you can load in other flash content, or make HTTP connections, etc. etc.
That’s all assuming you mean AS3. Does that help? If not you’re going to have to make your question more specific. 😉