I have this code I'm trying to load a file .txt in my FLEX project. But something weird is happening, it's giving me this error, but the main point is… I ran this code in Flash using Dynamic text instead TextArea… and it runs perfectly, I'm starting to think that I have some problem with my FLEX software… Does somebody could help me, please.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.events.*;
import flash.net.*;
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("external.txt"));
loader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event):void {
text1.text = e.target.data;
}
]]>
</mx:Script>
<mx:TextArea id="text1" x="209" y="275" width="226.66666" height="208.2738"/>
</mx:Application>
Severity and Description Path Resource Location Creation Time Id
1120: Access of undefined property loader. IVSketch/src IVSketch.mxml line 10 1261589517158 451
1120: Access of undefined property loader. IVSketch/src IVSketch.mxml line 11 1261589517159 452
1120: Access of undefined property onComplete. IVSketch/src IVSketch.mxml line 11 1261589517159 453
Best Answer
this should work.