PDA

View Full Version : URGENT! chat app problems live on website!


artane
05-03-2004, 10:54 AM
hi guys,

I've been experiencing a few problems with my chat applicaton.

First, the dynamic clock is displaying "0:00" at midnight. I've been looking at the code and it
should be displaying "12:00". Also, it seems that users cannot type in messages between midnight
and 1:00 am, the text chat "freezes". I'm assuming this is related to the clock problem.

The dynamic clock is working great but, on some computers, the time is 3 hours behind. When users post a message however, the correct flashcom server time is displayed. It is only the time on the running clock that is behind.

Anyone ever experience this?

I've attached the dynamic clock script from my chat movie and the main.asc file.

Thanks very much,

artane

.................................................. .....
chat app
.................................................. .....

var twenty4_ob = {_12:"12", _13:"1", _14:"2", _15:"3", _16:"4", _17:"5", _18:"6", _19:"7", _20:"8", _21:"9", _22:"10", _23:"11", _00:"12"}
// formats date obj that comes in from the main.asc time function.
showTime = function () {
this.onResult = function( myDate ) {
var hour = myDate.getHours()
var mnts = myDate.getMinutes()
var merid = " am"
// the the hour is bigger than 12, replace it with an element from our object.
if(hour>11){
// ex: if hour is 13, will look for _13 in our object and replace it with the string 01
hour = twenty4_ob["_"+hour]
merid = " pm"
}
// if the minutes are single digits like 1, or 2, this will add the 0 to display 01, or 02
if(mnts < 10){
mnts = "0" + mnts
}
var date_str = (hour.toString() + ":" + mnts.toString() + merid);

//+ " - "+(myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear());

time1_tx.text = date_str
}
}
// calls your getServerTime function on your asc file.
function getTime (){
simp.main_nc.call("getServerTime", new showTime)
}
// this function creates an interval that calls getTime function
// every 60 seconds or every minute.
function startClock () {
// 60000 millisecs is a minute.
myInterval = setInterval(getTime, 100)
}
//btn1.onPress = function(){
getTime()// gets current time
startClock()// gets time every minute
//}
// to clear the interval use
// clearInterval( myInterval )

.................................................. ......
main.asc
.................................................. ......

load("components.asc");
application.onAppStart = function(){
// new time object to replace the military time.
twenty4_ob = {_12:"12", _13:"1", _14:"2", _15:"3", _16:"4", _17:"5", _18:"6", _19:"7", _20:"8", _21:"9", _22:"10", _23:"11", _00:"12"}
}
application.onConnect = function( newClient ){
application.acceptConnection(newClient);

Client.prototype.getServerTime = function() {
return new Date();
}

/* sending back the time data,
note: I purposely did not format the time in anyway, that way you can add
any code to return the time / date the way you prefer. the only thing in this
scenerio that you should not take out the call it makes to the client, and if your
going to change the name of the method (getTimeStamp) make sure you change the call
from the Chat Component, in the .fla .
*/
newClient.getTimeStamp = function( newClient ){
var myDate = new Date()
var hour = myDate.getHours() + 1
var mnts = myDate.getMinutes()
var merid = "am"
// the the hour is bigger than 12, replace it with an element from our object.
if(hour>11){
// ex: if hour is 13, will look for _13 in our object and replace it with the string 01
hour = twenty4_ob["_"+hour]
merid = "pm"
}
if(hour == 00){
hour = twenty4_ob["_"+hour]
merid = "am"
}
// if the minutes are single digits like 1, or 2, this will add the 0 to display 01, or 02
if(mnts < 10){
mnts = "0" + mnts
}
var date_str = (hour.toString() + ":" + mnts.toString() + merid );
/* This will call a function in the clients chat component that will receive the time and date
and attach it to the users message before sending it to all clients.*/
this.call("_sendIt", null, date_str)
}
}

focus
05-10-2004, 06:56 AM
[B]hi artane please one cortesi send script set time chat bicaus realiz new site web for adult important set time example set 15 minut end 15 minut reject connection