A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: I need help on calling text file into flash

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    18
    Hi friends,
    Pls help me to call text file into flash by using javascript or other script language.

    I would like to call text from text file(sample.txt) & i want to show in input box through scripiting.

    regards
    shree

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    77

    Arrow loadvariables

    You can use the loadvariables function to do this

    create an mc with a text box in. set the text box to dynamic text and set variable to "textField".

    drop an instance of the move into scene one and name it "text_box".
    in the action layer set a keyframe as

    loadVariables ("text.txt", "_root.text_box");
    stop();

    now make a .txt file and start it with the line

    textField=
    your text here
    and save it in the same folder as the .fla (.swf)

    this will load the .txt file into the text are when the .swf has loaded

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    18
    hi Morris,
    Thank you very much for ur instant reply on my problem.It really worked out to be fruitful and i am able to import text successfully into a flash file.Once again thank you very much.

    shree

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Location
    sweden, östersund
    Posts
    263
    remember if u want to load several variables you need to do like this
    variable=masa&variable2=masa2&variable3=masa3

  5. #5
    Member
    Join Date
    Mar 2002
    Posts
    44
    How can I give variables in a textfile loaded
    with loadVariables, a different variable ??
    (Instead of showing them in a dynamic textbox...)

    for example:
    var1 = variable1_text.txt
    var2 = variable2_text.txt
    var3 = variable3_text.txt etc. etc.

    Please help...Thank you!

  6. #6
    Member
    Join Date
    Mar 2002
    Posts
    44
    Can anyone reply to my last post in this thread please ?

  7. #7
    Senior Member
    Join Date
    Dec 2000
    Location
    The Kingdom
    Posts
    124
    I'm not entirely sure what you mean, but do you want to have the variables in he text file renamed so you can use them elsewhere?

    If you load in variable1="text here" you can just put in the actionscript:

    newvariable = variable1


    and when you call newvariable it will display "text here".

    Is this what you mean? If not can you please elaborate.

  8. #8
    Member
    Join Date
    Mar 2002
    Posts
    44
    Yes , this is what I mean...
    I understand your explenation but how to write the
    actionscript.

    for loading it into a text box I use:

    loadVariables ("text.txt", "instance.textbox")

    I'm not sure how to write it for loading only...
    just loadVariables ("text.txt") ??

    Thanks for your reply





  9. #9
    Senior Member
    Join Date
    Dec 2000
    Location
    The Kingdom
    Posts
    124
    You could do one of two things. You could do

    loadVariables("text.txt", ""); or
    loadVariablesNum("text.txt", 0);

    You dont need to load variables into text boxes. The text boxes just show what the value of the variable is.

  10. #10
    Member
    Join Date
    Mar 2002
    Posts
    44
    oke...
    and how can I target a variable in a text file ?

    example:
    button 1 shows "text.txt" variable 1 in main_textbox
    button 2 shows "text.txt" variable 2 in main_textbox
    etc.



  11. #11
    Senior Member
    Join Date
    Dec 2000
    Location
    The Kingdom
    Posts
    124
    well if you have a text field called "textfield" for instance you would do this:

    load in the variables and in button1 have

    on (release) {
    textfield = variable1;
    }

    on the other one:

    on (release) {
    textfield = variable2;
    }


    nothing to it really.

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