Keyframes are essentially like sealed boxes of objects and code, similar to a MovieClip or Sprite class.
When you move the main playhead to a new keyframe, the data from the previous keyframe is no longer accessible.
This is one the problems with using the timeline for application states (or pages).
One solution is to build your application states within a MovieClip on frame1 of the main timeline and write your code on frame1 of the main timeline.
Since the main playhead never moves, the connection to the MovieClip is never broken.
The main code can be reached from the MovieClip via AS3 Event flow.
Another option is to write your main AS3 code on a layer that extends to the last frame of the main timeline.
ie: you would have 2 layers of code; a layer with keyframes for each page and a "global" layer accessible to the entire project from which you could access and control the music player. This approach usually results in decentralized "spaghetti-code" and a long main timeline that is tedious to edit and extend.
Personally, I find both of the preceding approaches to be less appealing than adding/removing movieclips or swf files, or just using structured classes to define the entire project. The timeline is for building animations.
|