Macromedia Flash Server - Strange sharedobject sync problem

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > June 2005 > Strange sharedobject sync problem





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 Strange sharedobject sync problem
Robin Southgate

2005-06-21, 7:49 am

Hi,
I=20have=20an=20RSO=20that=20is=20essent
ially=20a=20timer=20on=20the=20ser=
ver=20so=20that=20all=20clients=20can=20
see=20how=20long=20is=20left=20unt=
il=20an=20event=20occurs. =20Each=20client=20has=20this=20function
=20called=
=20by=20the=20onSync=20event:

public=20function=20updateTimer(val):Voi
d=20{
=09var=20raceStart=20=3D=20val.target.data.start;
=09var=20countDownNum=20=3D=20val.target.data.countDown;
=09if=20(countDownNum=20!=3D=20undefined
=20&&=20countDownNum=20!=3D=20""=20=
&&=20countDownNum=20<=3D60)=20{
=09=09myStartButton.setLabel("startRace",=20_global.textlist.getTextMessag=
e("Start_Race_Button")=20+=20"=20("=20+=20countDownNum.toString()=20+=20")=
"=20);
=09=09myStartButton.setLabel("startRaceShadow",=20_global.textlist.getText=
Message("Start_Race_Button")=20+=20"=20("=20+=20countDownNum.toString()=20=
+=20")"=20);
=09}
}

And=20on=20the=20comms=20server=20I=20ha
ve=20the=20following=20two=20funct=
ions=20that=20control=20a=20countdown=20
from=2060=20to=20zero:

application.startTimer=20=3D=20function(client)=20{
=09application.raceStart=20=3D=20SharedObject.get("raceStart",=20false);
=09var=20myRaceStart=20=3D=20new=20Date(
);
=09application.myRaceStartMilli=20=3D=20myRaceStart.getTime()=20+=20(1000*=
60);
=09application.raceStart.setProperty("start",application.=20myRaceStartMil=
li);
=09application. countDown=20=3D=20setInterval(applicatio
n,=20"doCountDown",=
=201000,=20client);
}

application.doCountDown=20=3D=20function(client)=20{
=09client.initiator=20=3D=20true;
=09var=20myNowTime=20=3D=20new=20Date();

=09var=20myNow=20=3D=20myNowTime.getTime();
=09application.raceStart.setProperty("countDown",=20Math.round((applicatio=
n.myRaceStartMilli=20-=20myNow)/1000));
=09if=20(myNow=20>=3D=20application.myRaceStartMilli)=20{
=09=09//start=20the=20race
=09=09trace("INITIATING=20RACE");
=09=09application.raceStart.clear();
=09=09clearInterval(application.countDown);
=09=09application.initiateRace(client);
=09=09client.call("raceStartSetup",=20null);
=09}
=09trace("Race=20starts=20in=20"=20+=20Math.round((application.myRaceStart=
Milli=20-=20myNow)/1000));
}

On=20the=20client=20I=20will=20see=20the
=20countdown=20from=2059=20all=20t=
he=20way=20down,=20but=20for=20no=20reas
on=20that=20I=20can=20figure=20it=20=
stops=20usually=20around=205=20seconds=2
0but=20sometimes=20as=20high=20as=20=
25=20seconds. =20Although=20I=20can=20see=20from=20tra
ces=20on=20the=20serv=
er=20that=20the=20RSO=20is=20still=20cha
nging=20and=20still=20counting=20d=
own=20and=20once=20the=20countdown=20hit
s=20zero=20the=20client=20receives=
=20the=20initiation=20and=20everything=2
0works=20fine.

Can=20anyone=20tell=20me=20why=20a=20sha
red=20object=20fails=20to=20receiv=
e=20onSync=20events=20after=20a=20certai
n=20amount=20of=20time?

This=20e- mail=20and=20any=20attached=20files=20ar
e=20for=20the=20exclusive=
=20use=20of=20the=20addressee=20and=20ma
y=20contain=20privileged=20and/or=20=
confidential=20information.=20If=20you=20receive=20this=20e-mail=20in=20er=
ror=20you=20should=20not=20disclose=20th
e=20contents=20to=20any=20other=20=
person=20nor=20take=20copies=20but=20sho
uld=20delete=20it=20and=20telephon=
e=20us=20immediately=20on=20+44(0)20=207
440=201100.

TEQUILA\=20London=20Limited=20does=20not
=20make=20any=20warranty=20as=20to=
=20the=20accuracy=20or=20completeness=20
of=20this=20e-mail=20and=20we=20ac=
cept=20no=20liability=20for=20its=20cont
ent=20or=20use.=20Any=20opinions=20=
expressed=20in=20this=20e- mail=20are=20those=20of=20the=20author=2
0and=20d=
o=20not=20necessarily=20reflect=20the=20
opinions=20of=20TEQUILA\=20London=20=
Limited.

TEQUILA\=20London=20Limited=20operates=2
0within=20the=20parameters=20set=20=
by=20the=20Data=20Protection=20Act=20199
8=20with=20regard=20to=20the=20use=
=20of=20personal=20information=20includi
ng=20e-mail=20addresses.=20We=20ac=
cept=20no=20liability=20for=20the=20forw
arding=20of=20this=20e-mail=20to=20=
other=20parties=20that=20may=20result=20
in=20unsolicited=20e-mails=20being=
=20received=20by=20those=20whose=20email
=20addresses=20appear=20in=20this=20=
e-mail.

=-----------------------------------------------------------
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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com