AS3.0 Creating an instance of a function, with singleton?

Started by
1 comment, last by jeteran 11 years, 8 months ago
Hello every one !

I'm working on a game that has many .as files, one of the is called MainMenu.as where you select your current mission.

After finishing any mission, I want the game to take you back to that MainMenu.as so you can select another mission.

Thanks to Deft (really thanks !!) I'm working on a singleton pattern and actually works great. The thing is that I'm able to call back a function that is not the constructor of the class. So how can I do to call it? This is because I have the main code in the constructor.

If is not possible, I will change all the code so it goes to a function inside the MainMenu class instead of it's constructor.

Thanks so much guys !!
Advertisement
Hey there))

Just relocate you base code into separated method. Making constructor big not so good.
If you need to get re-usable code, wrap it with public method and call it wherever you want. This is true for singletons too.
Awesome, thanks Deft and thanks for sharing it to the community.

I will start doing it right now !!

Happy day !!

This topic is closed to new replies.

Advertisement