5 Replies Latest reply on Mar 22, 2011 12:27 AM by wosxieez

    how to make a button's label = mysql's value?

    tsper

      i have a mysql table "exbtn" :id, name, text, value


      1, Tom, Tom's, 2

      2, Jerry, Jerry's, 2

      3, Tim, Tim's, 1

      4, Joy, Joy's, 3

      ...

       

      flash builder made a php file, "getExbtnById"

       

      I want the label of "button01" = the name of "id=1"

      the label of "button02" = the name of "id=2"

       

      who can help me?   thanks!!!

        • 1. Re: how to make a button's label = mysql's value?
          haroon ghafoori

          Set the label of the buttons at the result handler of the service that is retrieving the lables from database.

          • 2. Re: how to make a button's label = mysql's value?
            tsper Level 1

            thanks for help, but i also don't know how to do

            that's my code of this part, could you help me to revise, thanks a lot!!!

             

             

            <fx:Script>
                    <![CDATA[
                        protected function submit_clickHandler(event:MouseEvent):void
                        {
                            exbtnData01 = new ExbtnData();               
                            getAllExbtnResult.token = exbtnService.getExbtnByID(1);
                        }       
                    ]]>
            </fx:Script>

             


               
            <fx:Declarations>   
                <valueObjects:HggexData id="hggexData"/>
                <s:CallResponder id="getExbtnByIDResult"/>
                <exbtnservice:ExbtnService id="exbtnService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
            </fx:Declarations>

             

             

             


            <s:Button id="submit" label="submit" click="submit_clickHandler(event)"/>
            <s:Button id="hggexBtn01" label="{exbtnData.name}" />

            • 3. Re: how to make a button's label = mysql's value?
              haroon ghafoori Level 1

                  I don't know how this code is written, but i think there should be some method (resultHandler) perhaps in CallResponder. There u can get the value of Bubtton label. I am putting here some code  and hope that will help you
                  to understand the concept.
                 
                  <fx:Script>
                      <![CDATA[
                          private var token:AsyncToken
                          [Bindable]
                          private exbtnData01:ExbtnData;              
                          protected function submit_clickHandler(event:MouseEvent):void
                          {
                              token = exbtnService.exbtnService.getExbtnByID(1);;
                          }      
                         
                          var responder:AsyncResponder = new AsyncResponder(resultHandler, faultHandler);
                          token.addResponder(responder);
                         
                         
                          public function resultHandler( event:ResultEvent, token:Object=null ):void
                          {
                              exbtnData01 =  event.result as ExbtnData;
                          }
                         
                          public function faultHandler( event:FaultEvent, token:Object=null ):void
                          {
                              Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail);
                          }
                      ]]>
                  </fx:Script>
                  <fx:Declarations>  
                      <exbtnservice:ExbtnService id="exbtnService" showBusyCursor="true"/>
                  </fx:Declarations>
                 
                  <s:Button id="submit" label="submit" click="submit_clickHandler(event)"/>
                  <s:Button id="hggexBtn01" label="{exbtnData.name}" />

              1 person found this helpful
              • 4. Re: how to make a button's label = mysql's value?
                tsper Level 1

                i should think about that, it's too hard for me.

                can i do like this?

                 

                <s:Button id="Btn01" label="{btnData(1).name}"/>

                1 is the id, is that right? how to defined?