Advanced Search

Results 1 to 9 of 9

Thread: dynamic text/text file/actionscript

  1. #1
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default dynamic text/text file/actionscript

    Hi folks

    Ive got a simple 'ticker' movie clip. Already reading a sinlge line of text from my external text file. I want to add a few lines of text to the text file and have the ticker movie clip grab a different line each time it hits frame one again.

    So, first pass of the ticker would read line 1, second pass line 2, third pass line 3 etc... Here is my working actionscript and also my text file content. Any input would be much appreciated.

    =====actionscript======
    myData = new LoadVars();
    myData.onLoad = function(){
    tickertext.text = this.content;
    };
    myData.load("tickertext.txt");
    ===end actionscript=====

    ===text file data=======
    content="this is the first line of text to display." - big bird, sesame street
    ===end text file content==

    i imagine the text file would change to:
    content1= first ine of text to display
    content2= second line of text to display

    maybe, any ideas ? thank you in advance.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Doing something like that with loadVaris is kind of cumbersome.

    I recommend switching over to XML.
    Then you can use an array and a for loop to do exactly what you're talking about.

  3. #3
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default thanks

    thanks for the reply Man

    Im just now getting a grasp on this stuff. My html and css is pretty tight, but my actionscripting and xml is not. I usually research as much as possible on my own, but im in a bind and will learn faster from a good example.

    If you have time, could you post and example xml snippet and also how the AS might call on that file ? or even link me to a nice tutorial ...I will keep studying in the meantime.

    thanks again

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    I made up a quick little example....

    Here is what it looks like
    Here is the source file
    Here is the XML

    The .fla is probably not as commented as you might need. Post back if you have any questions.

  5. #5
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default You Rock Medyman !

    Hey, thanks so much for taking the time to do that.

    I applied your method to my FLA. For the most part it's perfect. One thing that I don't think really matters, on your original file, and after applying it to mine, when 'previewing' in Flash, the 'output' log keeps kicking out what would normally be an error, with each pass of text the log shows "next", i am assuming that is normal and doesnt have anything to do with an error.

    Second, i tried everything i could to adjust this, placement, matching your set up exactly, scanning code for a place to change setting, But nothing is fixing this 'speed' issue, for example, the first pass is normal, then after the first pass everything speeds up immensely. Here is a link to my fla/xml if you get a chance.

    http://www.droptest.org/Ticker-V2.zip

    again, thank you so much.

  6. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Since you're just starting out with actionscript, here is the biggest tip I can give you: learn to love the trace function.

    If you look at the function "nextLine" (or something like that) you'll see a code line which says trace("next"). This is what's producing the next output. A trace function can be very useful in pinpointing the source of errors.

    Since a lot of work is done with abstract math and variables, it hard to conceptualize what these variables' values are at certain times. A trace call does just that. It also helps to figure out if everything is running as planned.

    Since, the "next" shows up in the output window, I know that the nextLine function is running. If that didn't show you, I would have a better idea of where to look for an error.

    I'll have a look at ur .fla and see if i can pinpoint the speed issue

  7. #7
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    I couldn't open the .fla. Are you using CS3? I haven't upgraded yet. If you still want me to look at it, back save it and reupload it.

    FYI, though:
    The speed is controlled in the scrollText() function

    Code:
    function scrollText() {
    	Text.xSlideTo(0, 5, "linear")
    	Text.onTweenComplete = nextLine
    }
    This controlls the speed of the entire animation. It shouldn't render different speeds after each time it loads, unless there is something overriding it.

    The mcTween sytax is such:

    Code:
    Text.xSlideTo( _x, time (secs), transition, delay, call back function)

  8. #8
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default file

    try that same link again, i replaced with a new file. Im going to play with that syntax in the meantime. I am interested to see if you get the same results i'm getting with the speed.

  9. #9
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hey...

    I'm actually not experiencing the same speed problem. Everything is running at the same speed as it should be.

    I'm not sure what could be happening.

    One suggestion though, you might want to slow down the animation because at it's current speed the animation is kind of hard to read.

Bookmarks

Posting Permissions

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