dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: SCROLLING LOADED TEXT??

  1. #1
    how do you scroll loadVariable text? is it possible

  2. #2
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    Code:
    // create a loadVars object
    myLoadVars = new LoadVars();
    // load some vars from a file or URL
    myLoadVars.load("myFile.txt");
    
    //create textfield
    _root.createTextField( "textField1", 1, 50, 50, 200, 200 );
    // set textfield params
    with ( _root.myTextMovie.textField1 ) {
    	selectable = false;
    	multiline = true;
    	wordWrap = true;
    	border = false;
    	embedFonts = true;
            // set text here
    	text = myLoadVars.myVariable;
    }

  3. #3
    thanks but what do i replace with what?

  4. #4
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    and to create scroller on the fly:
    Code:
    
    function addScroller ( movie, textField ) {
    	movie.attachMovie("FScrollBarSymbol", "scroller", 2);
    	var s = movie.scroller;
    	s._x = textField._x + textField._width;
    	s._y = textField._y;
    	s.setSize(textField._height);
    	s.setScrollTarget(textField);
    	s.setEnabled(true);
    	s.arrow.useHandCursor = true;
    }
    
    addScroller( _root, _root.textField1 );

  5. #5
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    replace "myFile.txt" with your text file.
    (the one that contains your variables)

    oh and I should mention that I haven't been able to either:
    get the handCursor to work with the scrollbar component (yet)
    nor have I been able to embed fonts and have the scroller work.


  6. #6

  7. #7
    Senior Member
    Join Date
    Feb 2000
    Posts
    119
    Is anyone else having troubles with the scrollbar component in MX?

    I finally got it to work using text from within a flash movie, but I have NO success getting it working using dynamic text

    The text shows up in the field, but it does not scroll.

    What am I doing wrong here, I tried embedding the font as well as using _sans and not embedding any fonts

    Anyone else?

  8. #8
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    updated code for scroller above:

    Code:
    function addScroller(movie, textField) {
    	movie.attachMovie("FScrollBarSymbol", "scroller", 4);
    	var s = movie.scroller;
    	s.setScrollTarget(textField);
    	s._x = textField._x+textField._width;
    	s._y = textField._y;
    	s.setSize(textField._height);
    	s.setEnabled(true);
    	s.upArrow_mc.useHandCursor = true;
    	s.downArrow_mc.useHandCursor = true;
    	s.scrollThumb_mc.useHandCursor = true;
    	s.scrollTrack_mc.useHandCursor = true;
    }
    addScroller(_root.myTextMovie, _root.myTextMovie.textField1);
    note, I still can't get it to work when I embed fonts.
    and at the moment I am having troubles getting any font to show, it is defaulting to Times New Roman ewwwwww

  9. #9

    Having similar issues

    I'm two problems with the scrollbar component:

    #1
    The first time the frame (containing the scrollbar component, dynamic text box, and .txt-loading actionScript) loads, the scrollbar does not function. If I visit another section of my movie and then return, it recognizes the full amount of dynamic text and it works.

    #2
    I have many frames loading in outside text files. These are back-to-back so I can use the 'next' and previous' actions for buttons I have. When the playhead enters the next/previous frame, it will load in the text file. However, I need to find a way to get the scrollbar to reset. New text is present, but the user is half way down the page or wherever the scrollbar was located when they clicked one of these buttons.

    There must be some INIT code that would solve both of these problems. I tried creating new keyframes, but that does not seem to reload or reset anything regarding the scroll.

    Any help is appreciated.

    03-18-2002 03:18 PM
    Originally posted by TheTrooper
    Is anyone else having troubles with the scrollbar component in MX?

    I finally got it to work using text from within a flash movie, but I have NO success getting it working using dynamic text

    The text shows up in the field, but it does not scroll.

    What am I doing wrong here, I tried embedding the font as well as using _sans and not embedding any fonts

    Anyone else?

  10. #10
    Senior Member
    Join Date
    Oct 2000
    Posts
    540
    I can get the text to load using loadvariables, but could someone help me with what I do to use the scroll bar component to scroll it? thank you

  11. #11
    Senior Member
    Join Date
    Jul 2000
    Posts
    336
    Originally posted by jhb
    I can get the text to load using loadvariables, but could someone help me with what I do to use the scroll bar component to scroll it? thank you

    Make sure that you are not loading the text into just a variable name...

    ie _root.mytext

    What you do now is give your textfield an instance name, such as myTextfield, get rid of the variable name there, and use the .text for that instance..

    So save the text to..

    myTextfield.text = "whatever";

    hope that helps.. ?

    .fe.

  12. #12
    Junior Member
    Join Date
    Mar 2002
    Posts
    3
    Yeah, same problem.
    Keep checking this thread, as people are working on it.

  13. #13
    Senior Member
    Join Date
    Oct 2000
    Posts
    540
    So if I have for example...

    The text file saved as writing.txt....
    text=some text some more text

    The textbox named as...
    text

    The targettextField on the scrollbar parameters...
    text

    What do I need to change?
    Just trying to understand. Thank you for the help.

  14. #14
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    it shouldn't matter, but as a matter of course,
    the name "text" is used in a textField as a property
    I wouldn't therefore use it as a variable name.
    try:
    textfile:
    someText=some text and some more text

    Flash:
    myTextfield.text = someText;


  15. #15
    Junior Member
    Join Date
    Oct 2000
    Posts
    7

    Smile Think I got it... (ScrollBar Dynamic Text)

    ScrollBar Dynamic Text

    I have been working on this for hours (Mind you I know jack about action script)

    But I have my problem - solved at least...


    Here is what I needed:

    To a large amount of dynamic text and have the scrollbar scroll...

    After trying for hours with it not working... I found a sample on Macromedia of how the used .text on a text field ... This solved my problem...

    Here is what my movie looks like:


    2 Text field
    1 button
    1 Scroll Bar


    I followed directions and created a text file called:

    sometext <-- instance name

    I had another textfield named:

    sampletext <--- instance name

    This field had tons of junk text which I wanted to load in the sometext field to scroll

    My button had this:

    on (press) {
    sometext.text = sampletext;
    }

    Once I added the .text to the end of sometext... I could click the button and the sampletext would not only load.. but at last SCROLl!!!

    Shezz...
    Anyway hope this helps someone who is like me and just couldn't get it to work...
    Now i can go to bed.

    Night all!
    -Ripbud

  16. #16

    Some success here too

    My file works a little differently than some others here, but this should help answer a few more questions. I'll try to keep this simple.

    - one movie; multiple frames, scenes, and text files.
    - breadcrumb navigation and next/previous buttons
    - one dynamic text field spanning many frames
    Instance = 'scrollingText'
    Variable = 'dynamicText'
    (frame 5 keyframe with many frames following)

    'dynamicText' is used to clear and load text; 'scrollingText' is used to scroll whatever appears in the text box (text being loaded from outside of Flash)

    The 'Target textField' for the scrollbar should automatically populate when you drag the component to the dynamic text box. If not, you can manually assign it in the Properties for the scrollbar component.

    scrollingText (or whatever instance name assigned to the text box)

    - Consecutive frames contain the ActionScript which first clears the text box and then loads a text file:

    dynamicText = ""
    loadVariablesNum("assets/test01.txt", 0);
    stop();

    At the beginning of each text file the following appears:

    dynamicText=

    For those who have reported a scrollbar appearing, but not functioning....try loading your text one (or more) frames BEFORE the scrollbar component and text box appear. The scrollbar does not seem to activate when your loadVariable code and scrollbar compenent are in the same frame.

    Emptying the textbox variable each time resets the scrollbar. Without it, new text would load in, but the scrollbar would not update. (EX: user scrolling down to the bottom of one page and then clicking a button to go to the next frame).

    Empty, then fill, repeat

    dynamicText = ""
    loadVariablesNum("assets/test01.txt", 0);
    stop();

    Just load a different text file each frame by editing the second line of code. You really only need one text box and one scrollbar keyframe.

    Hope this helps







  17. #17
    Junior Member
    Join Date
    Feb 2001
    Posts
    17
    yeah.. thanks to everyone who posted.. i was having same problem and got it worked out too..

    at it's most simple:

    i had a textfield with a fscrollbar attached.. the text field variable was text.text

    on that same frame i simply loaded the variable text=sometext from a text.txt file and then loaded a new variable text.text=text .. and that did it! scroll away.

    loadVariablesNum("text.txt", 0);
    text.text = text;

    easy when you now how.. but what a bastard to work out

  18. #18
    hehehe yeah

  19. #19
    Member
    Join Date
    Mar 2001
    Posts
    32

    Flash5/6 Bug

    Hi together,

    there is a bug under Mac OSX and Flash MX. I create a dynamic textfield with the instance name "mytext" and a scroller from the components panel, then i take a button with the options

    on (press) {
    loadVariables("../text/testtext.txt", "");
    }
    on (release) {
    mytext.htmltext = scrolltext;
    }

    (scrolltext is the name of the variable in the textfile testtext.txt)

    And now the bug:

    When i create a new Flash MX document it works, but when i open an flash 5 document and save it as Flash MX document it doesn't work!!

    hope it helps someone with the same problem, i tried hours on it.

    cu, mort

  20. #20
    Master Poo Flinger
    Join Date
    Sep 2000
    Posts
    318
    for some reason, and i have no idea why, but, loadVariables(...) doesn't seem to work for text fields that have a scrollbar attached to them, but the LoadVars Object works.

    say you have a MC called "text_box". it has a text field with the instance name "text_txt". and you have a text file called "text.txt", and the contents are:
    "test=LOTS O TEXT"

    Code:
    /* in the first frame of "text_box" */
    lvars = new LoadVars();
    lvars.load("text.txt");
    lvars.onLoad = function(success) {
    	if (success) {
    		text_txt.text = this.test; //variable name in text.txt
    	} else {
    		text_txt.text = "ERROR";
    	}
    };
    when i used "this.loadVariables(...)" and than said:
    text_txt.text = test

    after the text file loaded, text_txt.text would be undefined.

    my main question is: why doesn't it work the traditional way?
    [Edited by tweekmonster on 04-16-2002 at 01:30 PM]

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