4 Replies Latest reply on Jul 25, 2006 5:36 AM by chris.huston.t10

    AS3 Functions

    upshotvideo Level 1
      This may be a strange question, but say i have this function:

      public function myFunction():void{
      doThis();
      doThat();
      }

      Why does the function execute doThat() BEFORE doThis()?
      Thanks
        • 1. Re: AS3 Functions
          ntsiii Level 3
          It is not. How are you testing this? With Alerts? If so that is the issue.

          Alerts are not modal, the first is being displayed, then the second, immediately, covering the first.

          This appears like the second is displaying first, but is is not. Try dragging the alert to the side, you will see the first one behind it.

          Tracy
          • 2. Re: AS3 Functions
            ntsiii Level 3
            Further, NOTHING is modal in the flash Player. Not even "Modal" title windows.

            You must use events and handlers to achieve modal-like behavior.

            Tracy
            • 3. Re: AS3 Functions
              upshotvideo Level 1
              Thats exactly how i was testing it. thanks.
              Since i have you here, i hope, this issue first came up while debugging because of another issue. I have a function that sends a HTTPService to php script that updates a database. I have another HTTPService that writes out XML from the same DB to populate a datagrid. What I want this function to do is send the HTTPService that updates the DB, then right after that, send off the other one to update the XML, which would then in turn update the datagrid. I have them both in one function, but I think it just goes too fast for the second .send() to work. IS there a way to have another function execute when the first HTTPService is done doing its thing. Some sort of .onComplete?
              Thanks
              • 4. Re: AS3 Functions
                chris.huston.t10 Level 3
                You could add result to your HTTPService call as below:
                <mx:HTTPService
                id="some_service"
                method="POST"
                result="do_next_thing()"
                url=" http://something.php"
                useProxy="false"/>

                Vygo