I am trying to paste in text from a .txt file. everytime I do this my textbox just enlarges to fit the text. I can't scroll it and it goes off the stage.
I have tried using static, dynamic, and input textboxes and the same thing happens.. I tried to attach a scrollbar to it and it doesn't work. This is very frustrating any help would be very appreciated..
hey hey gkbdave,
have you ever used a components? if not, you'll find it's a snap...they are new to MX
1-just drag a textArea component onstage
2-name it in the property inspector, also setting it to html
3-formatting in its "parameters" panel (see tab on property inspector)
4-format text with simple <html> tags
5-set .text variable in main timeline
here is the .fla
***edit***
had trouble figuring out why your fla was so big, there was a lot in the library that was not used (components, skins); also, the fla was set to Actionscript 2.0 (File>Publish Settings), which you may not need yet - i set the demo to AS 1.0 and deleted unused symbols from library...
Ok,
Looked at the fla.. All greek.. I can't figure it out at all..
I see the textbox component. But don't understand the code.
stop();
theTextBox.text = "<b>this is bold</b><br><br>after a line break this is <i>italic</I>";
theTextBox.text += "<br><br>APRIL <br>";//this line is added after the first in the text string with +=
theTextBox.text += "<br>2-3 Apr AZ Airdays, Davis Monthan AFB, AZ<br>";
theTextBox.text += "16-17 Apr Fiesta San Antonio, TX<br>"
theTextBox.text += "23-24 Apr Patrick AFB Open House, FL<br>"
None of the text is showing anywhere when I test movie.. the text on the left of the stage is what I always get..
first, check to see that the textarea component is still named correctly:
with Flash tool open, select the textarea component and look in the properties inspector, if you see "Instance Name" then enter "theTextBox" and test the movie
if you see "theTextBox" you should be ok and the problem lay elsewhere...
suggest that you drag an instance of the textarea component out (do you know how to do this?) and work with it - rather than thinking my .fla came through in working order
stop(); - - force of habit, i automatically type this when i create an actions layer
theTextBox.text = "<b>this is bold</b><br><br>after a line break this is <i>italic</I>";
here a string (everything in parentheses) is assigned as the value for the .text variable of the theTextBox object...you could just put the entire schedule into one quoted string...
theTextBox.text += "<br><br>APRIL <br>"
wrote this line as an example of how to append a string to a variable (add text to existing text)...this string gets added to the string above
theTextBox.text += "<br>2-3 Apr AZ Airdays, Davis Monthan AFB, AZ<br>"; and so on
HEy thanks for getting back to me and your patience.
I know how to drag the components onto the stage and make changes to the parameters. What I am hav ing probs with is understanding the actionscript that goes with it..
In your examples of the theTextBox.text=" blah blah blah" ..
Does this go in the text file that I have created or does this go in the text block in the parameters?
I guess what I am asking, is do I type my text file as html???
What I am tyring to do is put that schedule in a scrollable/selectable textbox. Loading from an external text file. The reason is that it changes all the time.. Is there another way to do this that would be easier??
i am working on a demo that will (hopefully) help to illustrate some of what you are headed for. my posts have been slow in coming , and somewhat incomplete in their explanations, partly due to the fact that i am having a devil of a time with the TextArea component. since joining your thread, i have read through the entire livedocs entry about that slippery widget, including the many discussion threads found there. that along with several articles/tutes; but enough groaning...
sounds as though you have the right approach, gkbdave, a remote text file is easily updated and can be loaded to your movie and inserted into a text object - be it a component or an old-fashioned text box.
i took a tangent into html formatting because i was unable to display your schedule correctly without it (spacing, empty lines). if there is a way around <html> tags for this, i too am eager to see it...(mods?)
for the loading of external files, this tute should help. and here is one that may shed light on the TextArea component - deals with loading XML formatted data (helpful in working with html tags)
by enabling a text object in Flash to accept/render <html>, and then "marking up the text (in the .txt file) with simple <html> tags, you can achieve the schedule layout displayed in your fla, and have scrollbars.
have to shut down for the night, that widget has given me another headache...
Hey,
Thanks for your time.. I wasn't expecting all you have done.. I really appreciate it..
As for this problem, I have read the tutorial. Actually still reading.. I never thought it would be this tough to fix this problem.
I look forward to your demo.. and I don't expect quick replies, actually they are faster than I would have ever expected..
Thanks again.. hopefully getting closer to a final to this prob
Those components are a bit persnickety. Have a look at this page, and you can download the .fla for dissection (zipped, attached to this post). Open the 'actions' layer (tip: use this in all of your movies, isolates scripts in one place), look at scripts attached to buttons, and examine the properties of the two components.
And here is yet another relevant tute dealing with text.
"...I wasn't expecting all you have done..."
this is largely how i have taught myself during my two years with Flash; so, thank you for posing such an interesting problem!
Nice demo.. I looked at the files and actionscript and I am getting it slowly..
I think I have it figure out now.. I don't knwo what happened but it works.. here is a swf that I made..see what you think..
thanks for all your help.. I really realy appreciate it..
check the site out.. I am hoping to have it up inthe next few days.. As long as I dont' have problems loading my .swf files into a loader or on load event.. uggghhh.. probably be asking for help again..
Looked at the scroller; nice work, that. Using a scroll component seems to be an easier solution, too. Good to see you sorted it all out. If you do decide to use a .txt file for easy update, you'll find plenty of help here at FK, I always do.
I found this freeware tool while searching yesterday, may be something useful if you receive the schedules as formatted .txt already Easy Text To HTML Converter
had that a lot in the last four days...
have been reading all about text boxes today, not the component variety...regular text boxes are extremely versatile: html, setFormat, variables AND instance names, uploading text, easily built scrollers (see this page)