Page 1 of 1

how to destruct OpenSpace Object and SFS object

Posted: 14 Sep 2009, 13:20
by rut1630
Hy,
One of the missions that we cooped with during testing of the engine, is
what to do when one of the xml maps is missing.
we decide to 'clean' up the memory from both the openspace object and
the smartfox object, and allocate them again. But seems to be some problem:

her's an explanation of our moves:

as far as we using flex, our openspace object is allocated the followed:

_osWrapper=new OpenSpaceFlexWrapper();
addChild(_osWrapper);
os=_osWrapper.os;


when 'destructing' the allocated objects we're making the next moves:

1) smartFox.leaveRoom(currentRoomId);
2) smartFox.logout();
3) smartFox.disconnect();
4) _os=null;
5) _osWrapper=null;


and of coarse removing all the attached events.


The problem:

when we call the 'build' function again (the 3 rows above) ,
everything work fine, but on part of the new openspace object, there seems to be upper white rectungled layer. this layer is hiding part of the
loaded openspace world.

it seems to us that some memory of the previous entity of openspace
wasn't 'released' properly.

Could you tell us please, what we did wrong in our 'destructing' process ?

Thanks alot

Posted: 15 Sep 2009, 21:54
by Bax

continue the issue

Posted: 16 Sep 2009, 03:53
by rut1630
Thanks for the replay.
The topic from the link was known to us beafore we
addressed you. It wasn't help us much, cause the first time we allocate
the os object (even threw as3), everything work fine. The problem is in
trying to release (delete) the object and allocate a new entety.

there is no point for us to put it in mxml, cause if so, it can't be releases
out of memory.

Or- maybe you have some other correct solution how user X choose
(or forced by connection failier to server) to logout of the world and then
try login again ?

Posted: 16 Sep 2009, 08:30
by Bax
Can you better explain why you need to destroy the OpenSpace instance and create a new one? Why not keeping the same instance?

continue the issue

Posted: 16 Sep 2009, 09:53
by rut1630
Hy.

We tryed to deal with 2 questions-

1) what to do on smartfox server connection failier,

2) what to do when the user asking to disconnect and want to login with
another user name

In both issues we've thought of 'deleteing' all the dynamic objects in the
application, and start over again- showing login, after that connect
to sfs, load the os etc.

Do you have any other idea, cause we're all come from C++ university
degrees and maybe our way of thinking is wrong and not sutable
for Flex/Flash AS3 solutions.

Re: continue the issue

Posted: 16 Sep 2009, 12:40
by Bax
1) what to do on smartfox server connection failier
Well, no reason to destroy the OpenSpace instance. You can create it once at the application initialization (even before the connection is established or the login box is shown) and then keep it till the browser is closed.
2) what to do when the user asking to disconnect and want to login with another user name
I would simply reload the browser page and restart from scratch.

end of the issue

Posted: 17 Sep 2009, 06:13
by rut1630
thanks very much for the both ideas, we'll do it that
way.