| Ultrashock Forums
• [AS3] Global Stage Singleton |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
Creative Assets
|
2008-03-19
#2 |
||
|
|
2008-03-20
#3 |
||
|
Thanks Azzan for the link but not quite what I was looking for. With my global Singleton I can do something like ActionScript Code:
Since that is stage functionality I wanted to be able to put that into my stage singleton. Thinking about it, it might not be the right way to go since my global singleton's only purpose pretty much is to create one instance. I was thinking of just making a stage manager class where I can handle all the stage properties and what not. |
|
17 Creative Assets
|
2008-03-20
#4 |
||
|
I would approach the singleton implementation in a slightly different way for this. You don't want to (and shouldn't) expose all of the Stage's properties and methods globally. For example, exposing addChild() and removeChild() ect wouldn't be a good idea. ActionScript 3.0 Code:
ActionScript 3.0 Code:
You can then import GlobalStage in any other class you need to use it in: ActionScript 3.0 Code:
|
|
|
2008-03-20
#5 |
||
|
Thanks Nutrox your right I don't want stageAlign and stageScaleMode to be available globally. I would like to be able to setup those properties inside the GlobalStage singleton and not have to worry about it, but then I was wondering if setting up a separate StageManager class would be the way to go but that might just be overkill.
|
|
17 Creative Assets
|
2008-03-20
#6 |
||
|
Why don't you just setup the stage in the main/document class?
|
|
|
2008-03-20
#7 |
||
|
Yeah I think I will just setup the stage in the main/document class. Would it be a good idea to still keep my above singleton as a global stage reference or is there a better way to approach this?
|
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|


6 comments
| 2118 views


Creative Assets
Linear Mode
http://flashrevolution.net/_global-in-actionscript-3/