A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: looping loadvariables command ? ups

  1. #1
    Junior Member
    Join Date
    Oct 2000
    Posts
    27

    Smile

    Hi (ups),

    i am trying to do a multiuser game.

    I am using: PHP4 + phplib, mysql and Flash5

    1.) FIRST User enters the site -> he gets a session ID
    the session id goes to the DB, table: "waiting player"

    2) SECOND User enters, gets session id, DB is looking
    if there is a waiting player (yes), the session from
    USER 1 is killed in the table waiting players and written
    to the table active_games

    3) THE problem: Everything in the DB goes well, but the
    actionscript for User 1 has always to look in the DB
    if its session is in active_games. I tryed looping
    this:
    FRAME 5:
    loadVariables ("index.php", "", "GET");
    FRAME 6:
    if (_root.co=="wait")
    gotoAndPlay(5);
    else if (_root.co == "play")
    gotoAndStop(10);
    The phpScript is sending co=play, but it seems that
    flash is not using the loop. It seems to stop in Frame 6
    As User 2 is set to co=play immediatly it should jump to frame 10 - but it wont. I am displaying the variables, and they show WAIT for User1 and PLAY for User2

    Could anyone help, or give me a better way ?


  2. #2
    Senior Member
    Join Date
    Nov 2000
    Location
    Jerusalem, Isreal
    Posts
    254
    it is a long shot (or not)
    instead of == try eq.
    remember you are trying to check a string not a value...
    try it and tell me what went with it..
    good lick!

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Posts
    27

    Smile no

    Hi,

    i tried what you were telling me, but it wont help.
    if (_root.co eq "wait")
    gotoAndPlay(5);
    else if (_root.co eq "play")
    gotoAndStop(10);
    else
    gotoAndPlay(10);

    I did some other change too. It jumps to frame 10, but just because of the final else statement - so _root.co is NOT play and NOT wait. I also printed _root.co out. It seems to be "start", but changes to wait or play very fast.

    I also tried this:
    while (_root.co != "start")
    {
    if (_root.co eq "wait")
    gotoAndPlay(5);
    else if (_root.co eq "play")
    gotoAndStop(10);
    }

    As i tried this, flash hangs ... neverending loop or so.

    PLEASE HELP !

  4. #4
    Junior Member
    Join Date
    Oct 2000
    Posts
    27

    Smile could it be.... if yes, why and how

    Hi,

    I didnt solved the problem on my own, but i have another suggestion.

    My swf has 10 frames, in frame 5 i am grabing the variables from the DB, in Frame 6 i want to make a decision with these variables. But it seems that Flash does not know these variables at frame 6. the Variable co is "start". And "start" was set within flash.

    Could it be that flash knows the variables if the timeline stops or the movie is at the end ?!?!


  5. #5

    resolved

    Did you try setting it up in different ways? That helps me sometimes. Something like:
    Code:
    if (_root.co != "wait") 
    gotoAndPlay(10) 
    else if (_root.co != "play") 
    gotoAndStop(5)
    else
    continue
    I'm attempting a multiplayer game myself, but there's someone helping me out with it Hope you get this figured out

  6. #6
    Junior Member
    Join Date
    Oct 2000
    Posts
    27

    Smile

    Hi,

    it doesnt matter how ask for the variables, because flash didnt changed the variables at the meant frame.

    I tried to build a controller. It is a movieclip with this code:
    onClipEvent(enterframe)
    {
    if (_root.co != "start")
    _root.play();
    }

    That seems to go. But the player who is waiting for another has to look in a loop if another player has come to catch him for a game. And thats the point where flash hangs. I know will try to build another "loop controller" or so.

    Please send me your suggestions, i am sitting since 2 days in front of this problem.

  7. #7
    Junior Member
    Join Date
    Oct 2000
    Posts
    27

    Smile I DID IT !!!!!!!!!

    Hey !

    I just solved this damn problem. (YESYESYESYES!!!)

    As i mentioned above i built a controller for the waiting player, and this thing is working fine without endless loops !

    (Multiplayer Game ? - Is nomore a prob :-))))))))))


    Bye and thanks

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