hello,
i have made this log watcher for my testing.
it is very basic - loading an external file and putting its content to a
TextArea.
BUT.. for some reason it adds an extra redundant enpty line after every
line - as if the text have two RETURNs  (\n) on every line.
what m i doing wrong?

the condenseWhite on the TextArea is not solving this.

any idea?

here is my code(just point it to your own file):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical" initialize="init()">
     <mx:Script>
         <![CDATA[
             import mx.controls.Alert;

             private var myTimer:Timer;

             private function init():void{
                 myTimer = new Timer(1000, 0);
                 myTimer.addEventListener("timer", loadFile);
                 myTimer.start();
             }

             private function loadFile(event:TimerEvent):void{
                 var request:URLRequest = new URLRequest("D:/Documents
and Settings/someusername/Application Data/Macromedia/Flash
Player/Logs/flashlog.txt");
                 var loader:URLLoader = new URLLoader();
                 loader.dataFormat = URLLoaderDataFormat.TEXT;
                 loader.addEventListener(Event.COMPLETE,
completeHandler);
                 try {
                     loader.load(request);
                 } catch (error:Error) {
                     mx.controls.Alert.show("Unable to load file: " +
error);
                 }

             }

             private function completeHandler(event:Event):void {
                 var loader:URLLoader = URLLoader(event.target);
                 textAR.text = loader.data;
                 trace(textAR.textHeight);
                 if(scroll.selected == true)
                     textAR.verticalScrollPosition = 500;
             }

             private function stopStart():void{
                 if(run.selected == true)
                     myTimer.start();
                 else if(run.selected == false)
                     myTimer.stop();
             }

         ]]>
     </mx:Script>
     <mx:TextArea width="90%" height="50%" wordWrap="false" id="textAR"
         verticalScrollPosition="50" editable="false" />
     <mx:CheckBox id="scroll" label="scroll" />
     <mx:Button label="clear" click="textAR.text=''" />
     <mx:CheckBox id="run" label="run" selected="true"
click="stopStart()" />
</mx:Application>

 
<http://livedocs.macromedia.com/flex/2/langref/mx/controls/TextArea.html\
#condenseWhite>

Reply via email to