Well, I’m too embarrassed to post the source code. I wasn’t fully successful in implementing Lab 2. I had decided to use Flash 9 as a development environment. At first things were easy. Specifying the new document class in the FLA file (e.g., Lab2), I could create a separate ActionScript file with a class using this document class name (Lab 2). This represents the class of the root object. It is the display object in which other display objects are placed.
This part works just fine. I had some objects in the library which I could refer to and manipulate on the stage. The document class needed to extend either Sprite or MovieClip (if you plan to reference the timeline). More implementation details can be found here.
A key useful thing I learned is that:
Unlike other display object classes you make, the stage property of a Document class will always be accessible since the document class is inherently a child of the stage. Similarly, if you place any objects on the main timeline in Flash, they will already be children of the Document class when its instantiated.
So here’s the problem. I wanted to make twinkling stars. These would be generated and placed on the stage from a TwinklingStars class in another external AS3 file. But the base MovieClip object is actually in the library of the Fla. What I can’t figure out is how to get these to display on the stage. I spent copious amounts of time studying this and am stumped. It’s a both a novice issue and one having to do with little available documentation. More clues are available here, but my stars are still broken… so time for a break on this problem.
So here is Lab2 without source (for the time-being) and without stars.
For Lab3 (a maze), I will probably write the entire project in AS3 but embed objects from a separate FLA file.
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment