A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: using a text file

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    Hello,

    I want to be able to load a text file of variables and there values, the values being text i.e. variable1 = "hello", I then want to place the variable value into an input text field.
    I looked at the dynamic graph tutorial but still can't work it out?
    I've got a text file called mydata.txt that says text1 = "hello"
    my movie has an input text field (variable name textspace), and a button that
    says:

    on (release) {
    loadVariablesNum ("mydata.txt", 0);
    textspace = text1;
    }

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    two problems - there should not be spaces in your text file nor quotes
    text1=hello
    the other one: when you do loadvariables you just request the data - they will arrive later. Search for posts with "wait" and "loop" or "frame" - there will be a lot of them that describe the technique

    Musicman

  3. #3
    Member
    Join Date
    Sep 2001
    Posts
    51

    txt files

    Hi dogmatix,

    had a similar problem yersterday. was helped by mr. actionspcript himself.

    problem could be:

    - your txt-file and the swf are not located in the same subdomain

    - you should use a dynamic textfield and the variable should be named text1

    - in your mydata.txt it has to say &text1=helloblabla

    - you should create a movieclip in the main timeline which contains the dynamic textfield

    - you have to give the instance of the MC a name, the name has to be the name of your swf

    - furthermore with your script

    loadVariablesNum ("mydata.txt", 0);

    your loading the text file contents on level 0 of your main timeline, but not in your textfield, change it to

    loadVariablesNum ("mydata.txt", "_root.instanceName");

    so that the vars are loaded into the MC containing the textfield.

    Hope that helps

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    335
    there are a little mistake in the previous message....

    when you want to load variables in the movie clip you should use

    loadVariables("mydata.txt", "_root.instanceName");




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