A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] loading txt or doc

  1. #1
    Member
    Join Date
    Jul 2003
    Posts
    31

    loading txt or doc

    I've written some stories and my friends at school like them. I decided to have them hosted on my site using flash (of course). I will update often and my friends could just check there instead of asking me. How can I use mdb or something to load the txt file into the flash without having to copy and paste it all into a text object within flash itself?

    Thanks.

  2. #2
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    you can just save each of your stories as a .txt file and import that into your dynamic text field in flash. then have a buttons that load the next and previous stories

  3. #3
    Member
    Join Date
    Jul 2003
    Posts
    31
    AHHH

    I waited hours for a response and I get one and you didn't answer

    I need to know HOW to have a button load the txt into the dynamic field... just... "<varname> = dfsdjhf I have no idea....

  4. #4
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    right, sorry....didn't know you needed that too.

    -make a .txt file with all of your stories in it
    -your text document should look like this (notice you have the story variable separating each story)

    &story1=paste text from story 1 here
    &story2=paste text from story 2 here
    &story3=paste text from story 3 here

    -drag a text box on your stage, give it an instance name of "myTextBox"

    -drag a scrollbar component on the stage, in the property inspector set it's target path to "myTextBox" (this will scroll the story you load)

    -to load a story into your text field, the code will look like this:
    code:

    myStory = new LoadVars();
    myStory.load("myStory.txt");
    myStory.onLoad = function(success){
    if(success){
    trace("done loading");
    myTextBox.html = false;
    myTextBox.text = this.story1;
    }else{
    trace("not loaded");
    }
    }




    -then for your buttons, you can make however many buttons as you have stories, and assign an intance name to each....and your user can click on that story to view it like so: (my button instance name is story2_btn)
    code:

    story2_btn.onPress = function(){
    myTextBox.text = myStory.story2;
    }



    the above code will load the next story for your user

    just keep adding buttons as you get more stories, this way a user can click on an exact story instead of clicking next and previous just to get to the LAST one....if you have 10 stories that will be a pain in the rear



    okay, hope this helps for you


    best,

    josiah

  5. #5
    Member
    Join Date
    Jul 2003
    Posts
    31
    hey. .i dont know what im doing wrong


    i started going through your post and i understood most parts so i modified the code, but that didnt work

    then i tried again but i did it word for word with your code, still no luck

    if it couldnt trouble you, could you attach or send via email an FLA of what im looking for? maybe im doing something wrong?

    also, how would i do the opposite and SAVE to the TXT file? like a guest book, but really simplified and so that only I could view it
    Last edited by undergroundman; 10-12-2009 at 09:34 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