A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Remoting: Flash freezes waiting for data to be returned

  1. #1

    Remoting: Flash freezes waiting for data to be returned

    Here is my application setup:
    AS 2
    AS 2 Components
    AMFPHP
    PHP 4.x
    Apache
    MySQL

    What is happening is when I make a call to retrieve some values I change my cursor to a custom cursor that rotates ... kind of like the Mac rainbow swirl or Windows hourglass cursors that signify a process is happening.

    What I would LIKE to happen is while the Flash movie is waiting on the return of the values from the server the cursor just spins nicely making the user feel something is happeneing. But, what IS happening is that everything freezes...no rotations, no animations, no nothing until the _Result callback function is called.

    I have even tested the severity of this by putting a counter on the Stage that is triggered by a setInterval every 1 second and I force a stage redraw with updateAfterEvent() but even that freezes and I know the system clock isn't freezing...or at least I hope not.

    So has anyone expereinced this and has anyone created a solution to this?

    It just looks so bad to the user when they submit a query or request data and the whole Flash movei freezes until data is returned.

    Thanks much!!

  2. #2
    Member
    Join Date
    Jan 2005
    Posts
    42
    i cannot think of any reason for this (client freeze during remoting call) to happen. it never happened with my remoting projects...
    do you have some code with that?

  3. #3
    Subhero, well I am glad to hear you haven't had that problem before. That might narrow it down to it being something in my code because I have had that problem on another remoting project where I used Coldfusion rather than AMFPHP.

    Here is some code that might shine more light on what I am doing:

    code:

    //-------------------------------------------------
    // REMOTING
    //-------------------------------------------------

    //create connection and GET service
    var doGetService:Service = new Service("http://xx.xx.xx.xxx/gateway.php", null, "LSRoom_Remoting", null, new RelayResponder(this, "doGet_Result", "doGet_Fault"));


    //share connection from GET service and create SET service
    var doSetService:Service = new Service(null, null, "LSRoom_Remoting", doGetService.connection, new RelayResponder(this, "doSet_Result", "doSet_Fault"));


    //Responder Functions for doGet
    function doGet_Result( re:ResultEvent ){ // receive results
    // Mouse/Cursor display
    doCursor();

    getFormElement(parseGetResult(re.result));


    }

    function doGet_Fault( fe:FaultEvent ):Void { // receive fault
    trace( "no response for GET : " + fe.fault.faultstring);
    }

    //Responder function for doSet
    function doSet_Result(re:ResultEvent):Void { //receive results
    trace("successful reponse for SET : " + re.result);
    var error_msg = re.result.substring((re.result.lastIndexOf(":")+2) , re.result.length-1);
    var commandName = re.result.substring(0, re.result.indexOf(" "));

    if(datagridDeletion && error_msg != "ERROR"){
    //remove datagrid row for visual confirmation of deletion
    visScr.deleteRow();
    datagridDeletion = false;
    //message_txt.text = "Complete";
    displayMsg("Complete");
    }
    if(datagridAddition && error_msg != "ERROR"){
    visScr.addRow();
    datagridAddition = false;
    //message_txt.text = "Complete";
    displayMsg("Complete");
    }
    }

    function doSet_Fault(fe:FaultEvent):Void { // receive fault
    trace("no response or error for SET : " + fe.fault.faultstring);
    }

    // This function determines who called it
    // and then displays or hides the custom cursor
    // The depth() function in the attachMovie is my own
    // custom depth management -- just didn't
    // want anyone to get confused as to what the heck that is
    function doCursor(){
    if(arguments.caller == doGet_Result || arguments.caller == doGet_Fault || arguments.caller == doSet_Result || arguments.caller == doSet_Fault){
    if(cursor){
    cursor = false;
    trace("");
    trace(" >>>> DO CURSOR : SHOW STANDARD <<<<");
    delete waitCursor.onMouseMove;
    this.waitCursor.removeMovieClip();
    Mouse.show();
    }
    }else if(arguments.caller == screen1.sendCLI){
    trace("");
    trace(" >>>> DO CURSOR : SHOW WAITING <<<<");
    cursor = true;
    Mouse.hide();
    this.attachMovie("waitingCursor", "waitCursor", depth());
    waitCursor._x = _xmouse;
    waitCursor._y = _ymouse;
    waitCursor.onMouseMove = function(){
    this._x = _xmouse;
    this._y = _ymouse;
    }
    }
    }



    Subhero, let me know if this helps or not. This is a very extensive application that includes some custom classes and I can share some more info is this does not help.

    Thanks again.

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