3 Replies Latest reply on Jun 13, 2011 3:42 AM by seismic data processing

    Server file to display in text area.

    seismic data processing

      I have file in server that i want to display in textarea directly without downloading it..is it possible?

      and if posiible then how ?

      Thanks in advance..

        • 1. Re: Server file to display in text area.
          Zolotoj Level 3

          Read it on the server and stream it back to Flex. What kind of data transport are you using?

          1 person found this helpful
          • 2. Re: Server file to display in text area.
            seismic data processing Level 1

            Is there any sample code or example that I can refer to to get an  idea of how to go about doing this? If you know of any such sample or  can show me working example I would be most grateful...I am using jsp on server side..

            • 3. Re: Server file to display in text area.
              seismic data processing Level 1

              <?xml version="1.0" encoding="utf-8"?>
              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:s="library://ns.adobe.com/flex/spark"
                             xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

                  <fx:Script>
                      <![CDATA[
                          import mx.controls.Alert;
                          import mx.events.FlexEvent;
                          var fileref:FileReference;
                      private    var urlreq:URLRequest;
                          private var urlload:URLLoader;
                          var filerefload:FileReference;
                      private var str:String="http://adobe.com/filename.txt";

               

               

                          protected function readfile(str:String):void
                          {
                              // TODO Auto-generated method stub
                              var loader:URLLoader=new URLLoader;
                              loader.load(new URLRequest(str));
                              loader.addEventListener(Event.COMPLETE,loadfile);
                          }
                          protected function loadfile(event:Event):void{
                              var filestring:String=event.target.data;
                              Alert.show(filestring);
                              l1.text=event.target.toString();
                           
                            
                          }

               

                      ]]>
                  </fx:Script>

               

                  <fx:Declarations>
                      <!-- Place non-visual elements (e.g., services, value objects) here -->
                  </fx:Declarations>
                  <s:Button x="150" y="28" label="Download File" width="120" id="dwnld" click="dwnld_clickHandler(event)"/>
                  <s:Button x="150" y="57" label="Load File" width="120" id="load" click="load_clickHandler(event)"/>
                  <s:TextArea x="116" y="119" width="191" id="textarea" creationComplete="readfile(str)"/>
                  <s:Label x="117" y="305" text="File Content" width="190" height="40" id="l1"/>
                 
              </s:Application>