This content has been marked as final.
Show 2 replies
-
1. Re: Loading text files info Text Fields on AS3
Newsgroup_User Aug 27, 2007 2:24 AM (in response to RGracia)when you set the htmlText of myT, that data isn't loaded yet. you should
add to your loader a listener for when its loaded, and only then set the
htmlText.
"RGracia" <webforumsuser@macromedia.com> wrote in message
news:fasrer$sgq$1@forums.macromedia.com...
> Hey guys, I am following some examples from Flash CS3 Help files and some
> portions of the ActionScript 3.0 Cookbook on TextFields. Here's the code I
> currently have on my first frame of the timeline. When I test the file, I
> get
> "TypeError: Error #2007: Parameter text must be non-null. at
> flash.text::TextField/set htmlText() at
> textFields_fla::MainTimeline/textFields_fla::frame1()"
>
> What's wrong?
>
>
>
> import flash.display.Sprite;
> import flash.events.*;
> import flash.net.*;
>
> var source:String = "html.txt";
> var dataFormat:String = URLLoaderDataFormat.TEXT;
>
>
> var loader:URLLoader = new URLLoader();
> loader.dataFormat = dataFormat;
> var request:URLRequest = new URLRequest(source);
> loader.load(request);
>
>
> var myT:TextField = new TextField();
> myT.autoSize = TextFieldAutoSize.LEFT;
> myT.width = 300;
> myT.wordWrap = true;
> myT.htmlText = loader.data;
> addChild(myT);
>
-
2. Re: Loading text files info Text Fields on AS3
RGracia Aug 27, 2007 4:42 AM (in response to Newsgroup_User)Ahh right, thanks. It works now after listening for COMPLETE:

