you can make a seperate class to handle the database
you can either make the class a singleton and then each view can getInstance or you can use a framework like swiz to inject the instance into each view
Thanks for reply.
i create the class for Database, but if i want do a query, i have to call the methods for connect it.
I don't know Singleton, now i read this.
have you got a good documentation of Singleton?
Thanks a lot!
I'm guessing you have to reconnect your class because you are instantiating it in each view
the idea is to instantiate and connect the database class and each view use the same instance (which is already connected) so you only want to instantiate the class once
You could do that in the main app and pass it to each view that needs it, but that can get complictaed and tedious for larger apps and not good practise
or use a singleton which acts like a global or static class, the same instance available everywhere
or (the best way) use a framework which instantiates the class for you and you can simply inject it to each view.
there are plenty of guides to AS3 singletons on google
I found this video useful. Its a bit long but might give you some ideas on the way to go
thank you so much, now i see the video, and read somethings....thanks a lot!