Groups | Blog | Home
all groups > macromedia flash flashcom > february 2007 >

macromedia flash flashcom : Cant get gc() to run


[djdomain]
2/26/2007 12:00:00 AM
Hi guys i am trying to run application.gc on disconnect of all users.

[q]
application.onDisconnect = function(client){
trace("disconnect: " + client.name);
application.users_so.setProperty(client.name, null);
if (application.clients.length < 1){
application.gc();
applications.shutdown()
}
}
[/q]

gc never seems to trigger and if i run a trace it returns false.

Anyone
calmchess333
2/26/2007 2:47:28 PM
calmchess333
2/26/2007 2:56:47 PM
calmchess333
2/26/2007 3:00:32 PM
[djdomain]
2/26/2007 3:50:06 PM
I did view the docs before posting.
calmchess333
2/26/2007 4:08:41 PM
yeah its server side action script that runs the garbage collection and since
its collecting and disposing of server garbage it has no data to return it just
simply cleans up. what exactly are you trying to do?
[djdomain]
2/26/2007 4:19:04 PM
right ok that makes sense.
But it would seem that it is not clearing up the garbage.

i have been building simple textchat with fms, i am sure you have seen the
example files.
When the last person leaves a room i then run amfphp to save history to mysql
db.
This is working fine but if a user re-enters the chatroom after leaving then
there is still the previous chat history from the SSO and again when he leave
this history is added to the db. so it is kind of a duplicate entry into the
db.
If i could run the gc() after the last user has left the chat room then when
he/she re-enters there should be a clean sheet. This is not the case.

I can still see the SSO in the FMS admin console.

thanks for any help
calmchess333
2/26/2007 4:42:51 PM
oh well why didn't you say so make the shared object non persistant then when
the user disconnects write null to the shared object .....something
like...SO.data.slot1 = null; heck you could even clear the shared object every
few minutes sure they wouldn't be able to scroll back up and read after the
text clears but at least you won't double write or you could just copy the text
into a second remote shared object and use that to write to your database and
after it writes to the database it clears its self thereby leaving the text
chat history intact.
calmchess333
2/26/2007 4:45:49 PM
heck appstop might even help you clear that crap.


[djdomain]
2/26/2007 5:10:01 PM
calmchess333
2/26/2007 5:59:17 PM
sure I can explain more a remote shared object does nothing more than hold data
so when you are done using the data then clear the remote shared object the
easiest way to clear it is to pass null to the remote shared object which
tells it data doesn't exsist in the remote shared object or you can pass double
quotes SO.data.slot1 = " "; to it also which is the same as passing null.If
you want to pass the contents of a dynamic text field into two objects you
would just write.... SO.data.slot1=mytext.text; SO.data.slot2 = mytext.text;
[djdomain]
2/26/2007 6:38:07 PM
Would this be the correct code to clear the SSO?
[q]
save_history.prototype.isHistory_Result = function(result){
application.users_so.setProperty(null, null);
application.shutdown();
}
[/q]
?

thanks
calmchess333
2/26/2007 7:23:38 PM
here are two links the first one shows all of the server side actionscript that
you can use the second one is the serverside shared object methods and such.


http://livedocs.adobe.com/fms/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?conte
xt=LiveDocs_Parts&file=00000649.html



http://livedocs.adobe.com/fms/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?conte
xt=LiveDocs_Parts&file=00000649.html
[djdomain]
2/26/2007 7:26:54 PM
those 2 links you posted in a previous post and dont help my situation and have nothing to do with SSO

calmchess333
2/26/2007 7:38:23 PM
I guess I don't understand how you are writing to the database sorry I was just
putting in my two cents.........I write to my database using php so maybe what
I said above isn't relevent to your situation and you should repost this
question....or give your code a try untill you succeed.
[djdomain]
2/26/2007 7:47:48 PM
All i want to do is when the last user has left the room trigger a function of
some sort to clear the SSO so that in the off chance that the user decides to
go back into the room a minute later the previuos conversation is gone.
So i need to clear the SSO but i dont know how to do that.
Brentley_11
2/26/2007 11:21:02 PM
save_history.prototype.isHistory_Result = function(result){
application.users_so.clear();
application.shutdown();
}

[djdomain]
2/27/2007 12:00:00 AM
neither has worked. :(
i tried to do a trace but nothing is returned
[q]
application.onDisconnect = function(client){
trace("disconnect: " + client.name);
application.users_so.setProperty(client.name, null);
if (application.clients.length < 1){
var names = application.users_so.getPropertyNames();
for (k in names){
var propVal = application.users_so.getProperty(names[k]);
trace("Value of property " + names[k] + " = " + propVal);
}
save_history();
}
}
[/q]
calmchess333
2/27/2007 4:58:56 PM
keep tring maybe do something else untill you become a master with server side
scripting .....you know do simple stuff and work your way up sounds like what
you want to do is pretty complex so simplify your sever side scripting projects
for a few days.
[djdomain]
2/27/2007 5:05:21 PM
[q][i]Originally posted by: [b][b]calmchess333[/b][/b][/i]
keep tring maybe do something else untill you become a master with server side
scripting .....you know do simple stuff and work your way up sounds like what
you want to do is pretty complex so simplify your sever side scripting projects
for a few days.[/q]
Ha ha great minds think alike :)
Just spent the day building theCMS for the chatroom today.

AddThis Social Bookmark Button