A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: FlashCom App Problem

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    2
    Hi -

    Example App is located here:
    http://www.onwisconsincars.com/flash...08.06.2002.swf

    Code is located here:
    http://www.designradar.com/dev/downl...n_flashcom.zip

    I am having problems syncing a clock countdown across multiple client windows. The above app works, except since all the windows use a setInterval they will eventually compete with one another to update the clock.

    I plan on having a few clients, lets say 4, connect to this app. At some point one user would reset the clock, and that should be reset across all client windows (and synced up).

    Let's say if another person clicks the reset button, then once again it should reset and sync up across all client windows.

    I guess what really prohibits me from doing this is completely understanding how the windows gets synced. As I understand it I need to share info through the server via a variable. Is that not correct? Maybe there is a much easier way to do this that I do not immediately recognize.

    With the sharedball example it updates the x and y vars on the server side which then get read in by each client.

    With mine if I use a setInterval I would expect I only want one running at a time, not quite sure how to do that. Or maybe I just pass a "RESET" variable to the server. Then each client window based on that switch resets the clock internally. (would there be any sort of lag or delay with that though?)

    I'm open to any suggestions, ideas, or help of any kind!

    Thanks,

    Dennis

  2. #2
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    Hey - did you see my reply on ultrashock?

    I guess what really prohibits me from doing this is completely understanding how the windows gets synced. As I understand it I need to share info through the server via a variable. Is that not correct? Maybe there is a much easier way to do this that I do not immediately recognize.
    What happens, is that anytime the so changes on the server (someone updates it, etc) it sends a sync message to all the connected clients. So what you want to do is simply send a variable (say the amount of time you want to countdown to be) once to the so, it will then send it to all the clients and they reset their countdown. Then you want each client to run the countdown code on their own, with none of them touching the so again.

    You can check out my avatar chat if you want - What it does is when you click where you want to go, it sends the _x,_y where you clicked, and then on each screen, your character moves there. Unlike the shared-ball example, it isn't updating the so every time the position changes, but it updates only once, the character on the client side just moves until it gets there. find the link in my footer.

    So in your app, you'd only be sending the amount of time to countdown, and each client would countdown on their own. You will probably see some latency, but it's a tiny amount of data, so it shouldn't be too bad.

    Hope that helps!
    psx

  3. #3
    Junior Member
    Join Date
    Aug 2002
    Posts
    2
    Originally posted by psychlonex
    [B]Hey - did you see my reply on ultrashock?
    Yes I did, thanks. Just fishing for other replies and seeing what others think. Thanks again for the help. Looks like I should have a fun weekend trying this all out!

    Thanks,

    Dennis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center