2 Replies Latest reply on Jun 28, 2010 5:49 AM by alice_data

    Loading Textual Data from HttpService Would Not Show Up on TextArea



        I have something fairly strange here that I have a little problem getting it to work. I am loading some data from XML and attempt to format it a little more on Actiosncript and print it out on the TextArea. For some reason, it would not show up, even though when I used Alert.show it does spit out the entire xml data set. Based on this, I know my data has been loaded correctly, but I am not sure why it is not showing up on my page.

      Here is the code,


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
              <mx:State name="view">
                <mx:RemoveChild target="{intro}"/>
                  <mx:AddChild relativeTo="{applicationcontrolbar1}" position="before">
                      <mx:TextArea editable="false" id="viewText" width="450" height="279" text="{messageInfo}"/>

                  import mx.events.ItemClickEvent;
                  import mx.controls.Alert;
                  import mx.rpc.events.ResultEvent;
                  import mx.rpc.events.FaultEvent;
                  [Bindable]private var message:XMLList;
                  [Bindable]private var messageInfo:XMLList;
                  private var savedIndex:int = 99999;
         private function clickHandler(event:ItemClickEvent):void {
                      if (event.index == savedIndex) {
                          //don't do a thing
                      else {
                          savedIndex = event.index;
                            navigateToURL(new URLRequest("../"+ event.item.data));
                  private function toggleButtonBar_itemClick(evt:ItemClickEvent):void {
                      currentState = evt.item.data;
                      if(evt.item.data == "view") view();
                 private function view():void{
                 private function httpService_fault(evt:FaultEvent):void {
                      var title:String = evt.type + " (" + evt.fault.faultCode + ")";
                      var text:String = evt.fault.faultString;
                      Alert.show("There is an error! Type " + title + " " + text);
                 private function httpService_result(evt:ResultEvent):void {
                      messageInfo = XML(evt.result).messages.message;
                      message = XML(evt.result);
                      var message_name:String = "";
                      var message_phone:String = "";
          for each (var message:XML in messageInfo.messages.message) { 
                viewText.text += "Name " + messageInfo.name + "\n";
                viewText.text += "Phone " + messageInfo.phone + "\n";               

      <mx:HTTPService id="userView" url="messages.xml" resultFormat="e4x"
        fault="httpService_fault(event);" result="httpService_result(event)" />
      <mx:PhoneNumberValidator id="pnVal" source="{your_phone}" property="text"/>
      <mx:EmailValidator id="emailVal" source="{your_email}" property="text"/>

          <mx:Array id="dp">
              <mx:Object data="view" label="View"/>
          <mx:Panel id="panel" title="My Home" height="70%">            
          <mx:TextArea id="intro" width="77%" height="100" borderStyle="none" paddingLeft="10" color="black">
                  <mx:htmlText><![CDATA[Welcome to my page.]]></mx:htmlText>
               <mx:ApplicationControlBar id="applicationcontrolbar1">
              <mx:ToggleButtonBar id="toggleButtonBar" color="#FFFFCC"
                      itemClick="toggleButtonBar_itemClick(event);" />


      Note, there are other items in the array, but those are not relevant to the question of the topic here, and therefore I am not posting the code for those sections.


      When I click on the View button, it does give me the correct state, but I get a blank box of textArea with no data when I know there is output from Alert.show in the view(). What have I missed?

      Thanks for your help.