dynamic flash text

Out of context: Reply #9

  • Started
  • Last post
  • 11 Responses
  • welded0

    It's quite simple to do what you want, actually. You can have as many variables defined in a single text file as you like, so you could have each file structured something like this:

    &storyID_1=123&title_1=This Is The Headline&story_1=Blah blah blah blah blah blah blah...[etc]......

    Or if you want to use two text files for each story, put the ID and the title in one then the main article in another. This'll speed up the initial loading time. Anyway, since you're already asigning a value to a variable (the title text) it's simple to asign a value to a button on top of the title at the same time. By this I mean:

    onRelease {
    var storyID = storyID_1;
    gotoAndStop("articlePage");
    }
    (or something like that)

    So each button will have a different storyID attatched to it based on what text files you've loaded and this ID will determine what story is loaded on your "articlePage" keyframe.

    My instructions might be a bit off, it's been some time since I've used Flash but I've done pretty much exactly what you want to do in the past. It might be simpler in the future to use a PHP/mySQL backend, but while learning, flatfiles will work just fine.

    Next, if your client want to change the text files himself, then you have two options: a) Either he can modify them offline then FTP them into place and overwrite older files, or b) Use a PHP script to modify the text files. The first option might be easier for you until he messing something up and deletes all of his press articles, but I think it would be in your best interest to spend a bit of time and research how to read-write text files with PHP. It's really quite easy, but if you've got problems, let me know. I know I have an older script kicking around that will point you in the right direction.

    So enough reading, get to work and *good luck*!!

    :)

View thread