9 Replies Latest reply on May 4, 2010 4:51 PM by mroiler

    It worked before...?

    mroiler Level 1

      I have FlashBuilder 4 and I built a login. The Login worked perfectly untill now. When I click on the submit button nothing happens. This is the relavant code:



           <s:state name="[username]"/>

           <s:state name="[username]"/>

           <s:state name="[username]"/>



                  import mx.controls.Alert;
                  import mx.rpc.events.ResultEvent;

                public function buttonlogin_clickHandler(event:ResultEvent):void
                                if(event.result.loginsuccess == "yes")
                                    currentState =username.text;
                                if(event.result.loginsuccess == "no")
                                    Alert.show("Invalid Username or Password");




                      <mx:Form x="-6" y="-5">
                          <mx:FormItem label="Username:">
                              <s:TextInput id="username"/>
                          <mx:FormItem label="Password:">
                              <s:TextInput id="password"
                              <s:Button id="buttonlogin"


      I got the php off a tutorial on adobe cookbooks. This is the php code:



      define( "DATABASE_SERVER", "[database server]" );

      define( "DATABASE_USERNAME", "[database username]" );

      define( "DATABASE_PASSWORD", "[database password]" );

      define( "DATABASE_NAME", "[database name]" );

      //connect to the database

      $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());

      //select the database

      mysql_select_db( DATABASE_NAME );

      //asign the data passed from Flex to variables

      $username = mysql_real_escape_string($_POST["username"]);

      $password = mysql_real_escape_string($_POST["password"]);

      //Query the database to see if the given username/password combination is valid.

      $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";

      $result = mysql_fetch_array(mysql_query($query));

      //start outputting the XML

      $output = "<loginsuccess>";

      //if the query returned true, the output <loginsuccess>yes</loginsuccess> else output <loginsuccess>no</loginsuccess>



      $output .= "no";       


      $output .= "yes";   


      $output .= "</loginsuccess>";

      //output all the XML

      print ($output);


        • 1. Re: It worked before...?
          David_F57 Level 5



          there could be a lot of things not happening, is your click event actually triggering the http request, do you have a fault event in case there is an error with the service call, place trace statements at the relevant parts of the code and run in debug to see what is happening.


          submit button click event trace("i am sending the request")


          httpservice fault event ("this didn't work to well")



          1 person found this helpful
          • 2. Re: It worked before...?
            mroiler Level 1

            Where do i place the breakpoints?

            • 3. Re: It worked before...?
              mroiler Level 1

              tried it as alert.show("text") istead of trace("text") and I got the alert for the button click event. I never got the HTTP Service fault alert.

              • 4. Re: It worked before...?
                David_F57 Level 5



                Ok so the service is being called,


                ok you can continue to place alerts where you need to but trace is much better as it doesn't 'stop' the app like alerts do. You still need to see if the result event has triggered.


                With trace() you  run in debug mode and trace strings show in the IDE status console as they get called. You can place trace statements all over the place without slowing or stalling the program, its like pre-debugging as it lets you get a feel for where the code may be misbehaving or in the case it isn't misbehaving where to set debug points on order to inspect things like results returned from the a service call.


                If you place a debug point in the calls result handler you can then inspect what data was returned if any, yhis is usually where I start if I think it was working or should be working.




                • 5. Re: It worked before...?
                  mroiler Level 1

                  Am i supposed to look in the Console panel in flash debuging perspective? Nothing new appeared when i clicked on the button.

                  • 6. Re: It worked before...?
                    David_F57 Level 5



                    If you a new to debugging I can do a connect session with you to give you visual pointers, its a lot easier than bouncing backwards and forwards in forums




                    1 person found this helpful
                    • 7. Re: It worked before...?
                      mroiler Level 1

                      I am not at my computer, I am working on somebody elses so I can't do that right now. I searched on google though and figured out how to view the traces. I have one trace in the function that the HTTPservice calls with a value of "Sending". It showed up. The fault trace on the HTTPService was not callled.

                      • 8. Re: It worked before...?
                        mroiler Level 1



                        I tried again later after I edited unrelavant parts of my application and my HTTPService fault trace appeared. I'm sure the file is there.

                        • 9. Re: It worked before...?
                          mroiler Level 1

                          After I tried again, I but a breakpoint on the closing curly bracket of the fault event. Inside the variables view I went Event> Fault> Fault detail and it's value was:

                          Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: [My HTTPService url]" errorID=2032]. URL: [My HTTPService url]


                          I also went to Event> Fault > Root Cause> current target> data and I HTML for the Page not found my Hosting provider uses I think it is a problem with them.