dcsimg
A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Scrolling Dynamic Text, like a ticker tape.

  1. #1
    Senior Member
    Join Date
    Oct 2000
    Posts
    138
    Can anyone help me with this please?

    I am looking to make a banner that includes an auto scolling line of text (from left to right). (an java example can be seen at the top of the page, here: http://www.veritas-it.co.uk)

    The text box must link to an external file that it can grab the text from. (This text will be constantly updated)

    Sometimes there may be more text than at other times.

    Is this possible?

    If anyone can help that would be great!

    Michael



    [Edited by freeeky on 09-19-2002 at 08:40 AM]

  2. #2
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    Cheap and dirty.

    If you load the scrolltext using loadvars or whatever, you can then display it in a standard dynamic textfield.

    Then as often as you wish (depending on the speed of scroll you are looking for):

    scrolltext = scrolltext.substring(1,text.length)+scrolltext.sub string(0,1);

  3. #3
    Senior Member
    Join Date
    Oct 2000
    Posts
    138
    hmmm...have you got a fla that could show me this?

    id really appreciate it if u could help me mate.

    Thanks

  4. #4
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Well Mush, I'd help yer mate if I had an address, but it is so easy it hardly seems worth the bother.

    0. Create a blank movie-clip and press F5 on the timeline twice to give you three frames.
    1. Put a textfield on the stage. Set it to "Dynamic" and set the variable to "scrolltext".
    2. Create a new layer and in frame one of the new layer put the code:
    scrolltext = "This is so piddly easy I am almost embarassed.";
    3. Click on the timeline for the new layer at frame 3 and press F6 to give yourself a new keyframe.
    4. In the new keyframe put the code:
    scrolltext = scrolltext.substring(1, text.length)+scrolltext.substring(0, 1);
    gotoAndPlay(2);

    Drag the movie-clip onto the stage and see what happens when you test the movie.

    All you need to do then is read-up on "loadVars" or similar and you are laughing like a laughing-boy who has been at the laughing gas too long.



  5. #5
    Senior Member
    Join Date
    Oct 2000
    Posts
    138
    excellent, thanks a lot mate. But how do i grab the text from and external .txt file?

    Thanks for your help its really appreciated.

    Michael

  6. #6
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Press F1 and look up "loadVars()" in the help menu.

  7. #7
    Senior Member
    Join Date
    Oct 2000
    Posts
    138
    I have a major problem here.

    The code works when i produce the documents with the above code, but as soon as i save the fla and re export the file, it doesnt work anymore!!!

    Is this a bug in flashMX?

    Thanks

  8. #8
    Senior Member
    Join Date
    Oct 2000
    Posts
    138
    ive sorted the saving problem, god knows what was going on!


    still cant work out this load var business to get an external text field into the scroll.

  9. #9
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    Because it is Friday

    Put the following code in the first frame, make sure the scrollmovie has the instance name "scrollmovie". Then save a textfile called "textfile.txt" containing the text "scrolltext=Whoopidoo the bugger works!" in the same location as your movie.

    downloadstuff = new LoadVars();
    downloadstuff.load("textfile.txt");
    downloadstuff.onLoad = function(success) {
    if (success) {
    _root.scrollmovie.scrolltext = downloadstuff.scrolltext;
    } else {
    _root.scrollmovie.scrolltext = "The cursed download failed, is the file in the right place?";
    }
    };
    [Edited by AlsoGaiusCoffey on 09-20-2002 at 08:23 AM]

  10. #10
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    Or to be a bit neater ...

    As an alternative, simply replace the contents of the first frame of your scroll MC with the following:

    scrolltext = " ";
    downloadstuff = new LoadVars();
    downloadstuff.load("scrolltext.txt");
    downloadstuff.onLoad = function(success) {
    if (success) {
    scrolltext = downloadstuff.scrolltext;
    }
    };

    The difference being that this way, the MC is entirely self-contained so you can drag it around to wherever you want and it'll work.

  11. #11
    Huygens to Titan PCRIDE's Avatar
    Join Date
    May 2002
    Location
    PLUTO
    Posts
    1,335
    Can't seem to get this working, I created the blank MC and put the code on the first frame in the MC, I tried the other way; putting the code on the first frame outside the MC.

    Any ideas ??
    All out of Honey Buffers, so i grabed a few Goose Heads

  12. #12
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    see if my :: XML-Driven Horizontal Ticker :: in my library helps
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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