|
Home > Archive > Macromedia Flash Server > April 2005 > Delete slot from RSO
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Delete slot from RSO
|
|
| Simon Lord 2005-04-17, 5:45 pm |
| Evening all, this is another SS RSO question.
I have an RSO with the names and times entered from everyone in a room
over a 24hr period. In order to keep this RSO short I'd like to remove
users from it that have not been to the room in the last 24hrs. Each
time they connect their data is updated to include the time in
milliseconds.
However, when *anyone* joins, I'd like to use the onConnect to run
through the existing RSO and check all the users that are stored there.
If any user times are greater than 24hrs (8640000 + the time in
milliseconds) then I'd like to remove that person.
Super trimmed down for legibility:
// -----------------------------------
application.onAppStart = function() {
ulog = SharedObject.get("users_log", true);
};
application.onConnect = function(client, name) {
myDate = new Date();
// get the current time in milliseconds and add 24hrs to it
var currentTime = myDate.getTime()+8640000;
// run through each user in this RSO
for (var i = 0; i < ulog.length; i++) {
var expireDate = ulog.getProperty(i);
// verify that this user has not been listed longer than 24hrs
if (expireDate.enterTime > currentTime) {
// delete this user from the RSO
}
}
};
// -----------------------------------
.... the first question I have is how do I approach the RSO? I'm still
fuzzy on how to properly scope out an *RSO* so the code above is really
only meant to portray what I *wish* to do.
Thanks.
Sincerely,
Simon
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Stefan Richter 2005-04-18, 7:45 am |
| Simon,
I think you need to do something like
var propNames = ulog.getPropertyNames();
for (x in propNames){
var slotObj = ulog.getProperty(propNames[x]);
if( slotObj != undefined ){
// now you can access your properties as slotObj.property
}
}
To delete a slot you set it to null.
Again check Brian's bible - ermm, I mean book - for a complete rundown on
SOs.
Stefan
> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of
> Simon Lord
> Sent: 17 April 2005 22:50
> To: flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> Subject: [FlashComm] Delete slot from RSO
>
> Evening all, this is another SS RSO question.
>
> I have an RSO with the names and times entered from everyone
> in a room over a 24hr period. In order to keep this RSO
> short I'd like to remove users from it that have not been to
> the room in the last 24hrs. Each time they connect their
> data is updated to include the time in milliseconds.
>
> However, when *anyone* joins, I'd like to use the onConnect
> to run through the existing RSO and check all the users that
> are stored there.
> If any user times are greater than 24hrs (8640000 + the time in
> milliseconds) then I'd like to remove that person.
>
> Super trimmed down for legibility:
>
> // -----------------------------------
> application.onAppStart = function() {
> ulog = SharedObject.get("users_log", true); };
> application.onConnect = function(client, name) {
> myDate = new Date();
> // get the current time in milliseconds and add 24hrs to it
> var currentTime = myDate.getTime()+8640000;
> // run through each user in this RSO
> for (var i = 0; i < ulog.length; i++) {
> var expireDate = ulog.getProperty(i);
> // verify that this user has not been listed
> longer than 24hrs
> if (expireDate.enterTime > currentTime) {
> // delete this user from the RSO
> }
> }
> };
> // -----------------------------------
>
> ... the first question I have is how do I approach the RSO?
> I'm still fuzzy on how to properly scope out an *RSO* so the
> code above is really only meant to portray what I *wish* to do.
>
> Thanks.
>
> Sincerely,
> Simon
>
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Simon Lord 2005-04-18, 5:45 pm |
| > Again check Brian's bible - ermm, I mean book - for a complete rundown
> on
> SOs.
Oh it's open. I just like to read manuals from end to end and not skip
all over the place. I invariably always miss that 1 line that stitches
together entire universes whenever I jump around.
>
> Stefan
>
>
>
>
>
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
Sincerely,
Simon
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Simon Lord 2005-04-18, 5:45 pm |
| This works great Stefan. Thanks very much!
> Simon,
> I think you need to do something like
>
> var propNames = ulog.getPropertyNames();
> for (x in propNames){
> var slotObj = ulog.getProperty(propNames[x]);
> if( slotObj != undefined ){
> // now you can access your properties as slotObj.property
> }
> }
>
> To delete a slot you set it to null.
>
> Again check Brian's bible - ermm, I mean book - for a complete rundown
> on
> SOs.
>
> Stefan
>
>
>
>
>
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
Sincerely,
Simon
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|
|
|
|
|