smartfox events
Posted: 13 Apr 2006, 07:37
I was wondering, i created a class to handle all the smartfox things happening.. i noticed that i can use.. smartfox.onLogin.. smartFox.onJoinRoom.. and so on..
When i create a class and want to listen to events originating from the class i cannot do it like u guys do..
suppose i have a class named Game and in that class i fire the event onBegin.. i create an instance of Game and call it game.
i cannot use game.onBegin to listened to the event, it just doesnt work.. i have to write three lines of code to do just that.
now i checked your smartfox client classes source code but could not find the solution for this problem.. Can u give me a hint or a small tutorial on how to be able to use game.OnBegin instead of the three lines of code i need to use now?
When i create a class and want to listen to events originating from the class i cannot do it like u guys do..
suppose i have a class named Game and in that class i fire the event onBegin.. i create an instance of Game and call it game.
i cannot use game.onBegin to listened to the event, it just doesnt work.. i have to write three lines of code to do just that.
Code: Select all
listener = {};
listener.onBegin = Delegate.create(this,onBegin);
game.addEventListener("onBegin",listener);