View Full Version : Loading a txt file into flash
mltgroup
12-14-2004, 11:05 PM
Hi,
I think I have my text file loaded correctly into the flash file, although it wont display and i can't for the life of me figure out how to get it into my dynamic scroll pane. can someone walk me through this
thanks
eric
mmm..pi..3.14..
12-14-2004, 11:38 PM
Did you search the forums first?? It's been discussed thousands of times here, millions of times on all the web :rolleyes: If you still need help I'll help you :)
Eric :D
mltgroup
12-14-2004, 11:57 PM
Eric,
I did search the site, i also tried the tutorial on here, but no dice. i'm going to try using myDynamicTextBox.text and see if i can get it into there, but i'm not very good with AS yet
thanks
eric
mmm..pi..3.14..
12-15-2004, 12:06 AM
Oh, your loading the text into a scrollpane?? Text can't go directly into a scrollpane as far as I know, the text needs to be in a movie clip first, then the movie clip needs to be loaded into the scrollpane. Can you put the text into a movie clip or do you need to load it from a text file??
mltgroup
12-15-2004, 02:11 PM
Actually, im trying to load the text file into a dynamic text box that is on the main frame window. I used the text tool to draw a box and made it dynamic type with multiple lines.
I do need to control what is in the text box from a movie inside of a scroll pane. But i think once i get the text to actually display i can handle that. I've done that with loading a second movie and controlling that.
would seeing an fla help with that?
also... how do the variables work in calling sections of the text.
i would have variables like this
&item1=something
&item2=something else
&item3=someting different etc.
thanks
eric
mmm..pi..3.14..
12-16-2004, 09:08 AM
An fla couldn't hurt, so go ahead and post it ;)
To load text into a text box, use this script:
var LoadText:LoadVars = new LoadVars()
LoadText.onLoad = function(success) {
if(success) {
myTextBox.text = this.myText
} else {
trace("Error loading text file")
}
}
LoadText.load("textFile.txt")
In the contents of "textFile.txt" (which is in the same directory as your fla), the contents should look like this:
&myText=if this is working, you will see this in the dynamic text box
This should work if your dynamic text box has the instance name "myTextBox". Let me know if there's any problems ;)
BTW: Sorry for the late reply (been busy :()
Eric
mltgroup
12-17-2004, 02:30 PM
Thanks for the reply eric,
I figured it out, not sure what i did off hand but it works now. sometime again i'll post the code as to what i did for others with this problem
mmm..pi..3.14..
12-17-2004, 08:01 PM
That would be good, kinda frustrating to find someone with the same problem as you and then have them figure it out and not post how they did it :rolleyes:
Eric :)
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.