unique name for dinamically created room ?
-
kotbegemot
- Posts: 82
- Joined: 21 Nov 2010, 05:05
- Location: Saint-Petersburg
unique name for dinamically created room ?
How i can set unique room name for dinamically created rooms, by name+random ? But random may be not unique...
Hi. You can try the Date.getTime() or the getTimer() methods to get an unique name 
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
-
kotbegemot
- Posts: 82
- Joined: 21 Nov 2010, 05:05
- Location: Saint-Petersburg
If you use the getTime method, i dont think you need the random. You can also try the Date method which returns the time has passed since a default date (sorry cant remember the name
)
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: unique name for dinamically created room ?
Just for reference, you can use this
(new Date()).getTimer()
I think there's a better way to convert the number to string but this works just fine
What I ended up doing just to be 100% sure is this
settings.setName((new Date()).getTime() + "_" + rooms.size());
Worst case where 2 rooms are added in the same millisecond, it will append the number of rooms present in the zone so that number will be different for the second room created.
(new Date()).getTimer()
I think there's a better way to convert the number to string but this works just fine
What I ended up doing just to be 100% sure is this
settings.setName((new Date()).getTime() + "_" + rooms.size());
Worst case where 2 rooms are added in the same millisecond, it will append the number of rooms present in the zone so that number will be different for the second room created.