I'm trying to figure out the best way to deal with writing multiple GUI windows using Flash Components. I thought the best way to handle this was to use a layer for each window that I want, and simply hide/show the layer I want for the window. It would be preferred to not use actionscript alone.
Since each layer holds these GUI components, I place the actionscript code dealing with them in Frame 1 of each layer. This keeps all the GUI code in one place and avoids me having every component declared and handled within the main stage class.
My problem though is a scoping issue. The main stage class can access all the components from its class that reside on these layers, but the frame layer "frame 1" actionscript doesn't seem to. I would like to be able to call methods on the main stage class from within the frame 1 actionscript code on the layer. It doesn't seem to work, and I've even tried casting the stage reference to the reference of my class. Not sure if this was stupid to try, but just trying to figure out a way.
If someone has a better way to go about handling this, please let me know. My fallback plan is to either avoid dragging and dropping the components on the stage and instead use actionscript alone, then organize these components into their own classes, or use event listeners on the main stage for all the components, which would bloat the stage class with all that GUI code.
Thanks!