Search Results

Search found 1 results on 1 pages for 'ielashi'.

Page 1/1 | 1 

  • Flex textarea control not updating properly.

    - by ielashi
    I am writing a flex application that involves modifying a textarea very frequently. I have encountered issues with the textarea sometimes not displaying my modifications. The following actionscript code illustrates my problem: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"> <mx:TextArea x="82" y="36" width="354" height="291" id="textArea" creationComplete="initApp()"/> <mx:Script> <![CDATA[ private var testSentence:String = "The big brown fox jumps over the lazy dog."; private var testCounter:int = 0; private function initApp():void { var timer:Timer = new Timer(10); timer.addEventListener(TimerEvent.TIMER, playSentence); timer.start(); } private function playSentence(event:TimerEvent):void { textArea.editable = false; if (testCounter == testSentence.length) { testCounter = 0; textArea.text += "\n"; } else { textArea.text += testSentence.charAt(testCounter++); } textArea.editable = true; } ]]> </mx:Script> </mx:Application> When you run the above code in a flex project, it should repeatedly print, character by character, the sentence "The big brown fox jumps over the lazy dog.". But, if you are typing into the textarea at the same time, you will notice the text the timer prints is distorted. I am really curious as to why this happens. The single-threaded nature of flex and disabling user input for the textarea when I make modifications should prevent this from happening, but for some reason this doesn't seem to be working. I must note too that, when running the timer at larger intervals (around 100ms) it seems to work perfectly, so I am tempted to think it's some kind of synchronization issue in the internals of the flex framework. Any ideas on what could be causing the problem?

    Read the article

1