• Advertisement
Sign in to follow this  

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

This topic is 1965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 !!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Awesome, thanks Deft and thanks for sharing it to the community.

I will start doing it right now !!

Happy day !!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement