A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: Help!! dynamic text box problem

  1. #1
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304

    Help!! dynamic text box problem

    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..

    What am I doing wrong.. I am using MX 2004

  2. #2
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    have you changed the textbox's "single line" property to "multiline" ?
    __azwaldo__

  3. #3
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    Yes I have it on multiline. I have attached the .fla..

    any help would be very helpful... I would rather load this text from a file but haven't been able to get that to work either...


    thanks again.
    Attached Files Attached Files

  4. #4
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    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
    __azwaldo__

  5. #5
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    I have tried that also.. But to no evail.. I am so frustrated..I am almost thinking that my flash program itself is screwed up..

    Did you look at the attached file??? anything I did wrong?

  6. #6
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    having trouble attaching file... working on it
    __azwaldo__

  7. #7
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745

    attachment

    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...
    Last edited by azwaldo; 02-09-2005 at 03:05 PM.
    __azwaldo__

  8. #8
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    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..

  9. #9
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    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

    hopefully you recognize the <html> tags...?
    __azwaldo__

  10. #10
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    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??

    thanks again..

  11. #11
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    hey hey,

    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...

    ***edit***
    if you've time, have a peek at these pages:
    Loading a Text File into a Dynamic Text Field
    Working with Dynamic Text and HTML
    Last edited by azwaldo; 02-10-2005 at 12:40 AM.
    __azwaldo__

  12. #12
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    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

  13. #13
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745

    got it

    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!

    =====got bookmark?=====
    http://www.kirupa.com/developer/actionscript/index.htm
    http://www.actionscript.org/tutorials.shtml
    http://www.moock.org/webdesign/flash/

    ... post again if stuck.
    Last edited by azwaldo; 02-10-2005 at 07:54 AM.
    __azwaldo__

  14. #14
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    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..

    thanks again..
    Attached Files Attached Files

  15. #15
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    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

    Keep on Flashin'
    __azwaldo__

  16. #16
    Senior Member gkbdave's Avatar
    Join Date
    Nov 2000
    Location
    Fort Bragg, NC
    Posts
    304
    i don't know why but for some reason.. It wasn't working and then today it just worked.. I don't get it..

    I still can't get the scrollbar to auto adjust to the textbox size..But I can live with that..

    Thanks for that link.. I really do thank you for your help.. Hopefully I can return the favor to someone someday..

  17. #17
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    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)
    __azwaldo__

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center