FORUMS: list search recent posts

need help with external txt file

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sean Butler
need help with external txt file
on Jan 13, 2010 at 9:21:46 pm

Hope someone can help. I'm pretty much a flash beginner. I've been handed a big flash project that's in its final stages. There is a links page that has 270 links that I hand typed for each in a dynamic text box. I saved and made a backup copy but when I opened it the next day all my links were gone. So I decided the easiest thing to do would be to have that dynamic text box call for an external txt file. I found several tutorials and got one to work initially ( but when I tried to implement the AS on the text field it does not work. It looks like the AS for the rest of the project is set to AS1 and AS2. I've tried the old code (lodevar or something like that) and that didn't work but neither is the AS3 (URLLoader). IS there any kindly soul out there that can help me with this? Thanks.


Return to posts index

demetri tashie
Re: need help with external txt file
on Jan 13, 2010 at 11:43:18 pm

i am having a little trouble understanding what you are doing. if you are trying to mix AS versions - don't.
AS3 is not compatable with older AS versions.

if i understood your issue better, i am sure there is a better way to accomplish what you want to do. but since you seem to be asking about loading in external text, here goes

if you need to continue in AS2 or 1 , I am not the person to help- maybe repost with AS2 in the title...
if you are trying to import an external text file ( .txt ) in AS3, here are the steps you need to do:

you create a URL Loader to load the external request
you specify the URL Request
you create a Text Field to be populated with your external text file
give the text field properties ( dimensions,etc , if you want)
its always good to test for COMPLETE ( also to check for erros, which i did not here...)
tell the Loader to load the URL Request
add the Loader to the display list ( let it be visible)( theis is the 'addChild' step)
the COMPLETE function now tells the text field to add the text.

this is the code that makes it work, in the same steps as above. hope it makes sense.
i add an advisory against using TextEdit from a mac to create your text files. it seems to add metadata to these files which will show up in these requests. use a different text editor.

var myURLLoader:URLLoader = new URLLoader();

var myURLRequest:URLRequest = new URLRequest('myText2.txt');

var myTextField:TextField = new TextField();
//myTextField.width = 500;
//myTextField.height =stage.stageHeight;
//myTextField.wordWrap = true;
//myTextField.border = true;

myURLLoader.addEventListener(Event.COMPLETE, loadedFunction);


function loadedFunction(evt:Event):void{

myTextField.text =;

Return to posts index

Sean Butler
Re: need help with external txt file
on Jan 14, 2010 at 4:22:30 am

Thank you for your help. I am not even certain about how to specify what my issue is but I got the same errors using your provided code as from the code I used in the tutorial I listed.Not sure If this will help but here they are:
The class or interface 'URLLoader' could not be loaded.

Return to posts index

demetri tashie
Re: need help with external txt file
on Jan 14, 2010 at 6:08:21 pm

not sure what to say, as the code will work- if you create a new balnk document and test it,i am sure you will find the same.

you state that this is a 'big flash project' and that you are 'a flash beginner' . i will assume that you are possibly not understanding correctly something - possibly the manner in which the file(s) are set up. are you using Docunmnet Classes? importing the correct classes ?

it is hard for me to trouble shoot further without more detailed information.

again- not understanding what you are trying to accomplish, i actually doubt that you would want to create 200+ links via an external text file. i've never heard of it being used that way before - but since that is what you were asking for, that is what i am/was trying to help you with : - )

being such a large project, and since you are a flash beginner, you might consider getting outside help. no shame in that- working on a team to get the project done as best as possible can be a great learning experience.

hope this helps.

Return to posts index

Marcus Geduld
Re: need help with external txt file
on Jan 18, 2010 at 9:28:48 pm

I want to underline something that demetri wrote, above, as it's been a problem for several people in this forum:

You CAN'T mix different versions of Actionscript in the same FLA/SWF! If there's even one line of AS1 code mixed in with AS3 code, the app won't work. This is often why people get continual errors when they update other people's files. The original author wrote in AS1 or AS2. The new author is writing in AS3.

When you choose File > Publish Settings and click on the Flash tab, what version of AS do you see listed? All code in your file MUST be written in this version. Changing the version will NOT change the code.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer,

Return to posts index

Sean Butler
Re: need help with external txt file
on Jan 19, 2010 at 12:06:58 am

Yeah I kind of had a feeling that was the case. The project is in AS1. I'm looking for an easier way to go about what I need to do now. I think I'm just going to make a page that calls up separate links by state. I can do that easy enough it's just tedious. Thanks for everybody's help and input I really appreciate it!

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved