init() function repeat more than one time at server start

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
mittico
Posts: 36
Joined: 08 Dec 2007, 13:00
Location: Santena

init() function repeat more than one time at server start

Post by mittico »

Hi,
We are creating a new online games application.
I defined some properties, like gameType and buyIn.
gameType is an Enum class, buyIn an array of buyIns.
When i start the server i automatically create rooms iterating and nest iterating trough gameType and buyIns so that finally i create buyIn.size *
gameType.values().length number of rooms.

I done this on the init() function:

Code: Select all

		public void init()
		{
			
			//declare the instance of my extensionHelper
			helper = ExtensionHelper.instance();

			//initialize my zone
			z = helper.getZone("myRoom");
			
			//Initialize Zone's room
			startServer();
			// Traces the message to the AdminTool and to the console
			trace("Hi! The myServer Server is initializing");
		}
the startServer() function initialize all the server rooms like i said.

The init() is multirepeated randomly.
it's my mistake or a bug?
thx
mitticooooo
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Post by patso »

The init function is called only one time in the extension life cycle. If I understood you right init function is called more then once("multirepeated "). If this is the case this may be is caused because you edit the extension and AutoReloadExtensions is enabled then when you edit you extension its automatically loaded again and logically the init function is called again(as well as the destroy function btw).
mittico
Posts: 36
Joined: 08 Dec 2007, 13:00
Location: Santena

Post by mittico »

If I understood you right init function is called more then once("multirepeated ")
yes.
If this is the case this may be is caused because you edit the extension
If you mean i'm creating new rooms at runtime the answer is yes.
AutoReloadExtensions is enabled then when you edit you extension its automatically loaded again
Yes it was enabled, i set it to false now and it show the same behaviour.

thx for your reply
mitticooooo
mittico
Posts: 36
Joined: 08 Dec 2007, 13:00
Location: Santena

problem solved

Post by mittico »

I found the answer to my problem on another post.
The trace function causes this problem,
I replaced it with system.out.println
bye.
mitticooooo
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Could you explain what the problem was?
It may help other people as well.
thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply