A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Load a Vairable from a text flile?

  1. #1

    Load a Vairable from a text flile?

    OK i have 6 frames and i am pulling in a vairable on each frame is there a way of doing something like below:

    fish = "line 1 of text file vair.txt"
    fish = "line 2 of text file vair.txt"
    fish = "line 3 of text file vair.txt"

    and so on and the text file would be like below

    1
    1
    3
    2
    4


    hope this makes sence

    Cheers Slaup

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    yes..(and no).. it wont be exactly like that..but you will get the same result.

    what you will need to use is a varObject (same as loadVariables)..but gives you more control (there is a link in my foeter that explains how to use the loadVar Object..called varObject)

    basically you have create a new loadvars object..(give it a name) we'll call it myVars

    this name: "myVars" refers to the WHOLE text file and everything in it.

    so you textFile could be like this:

    &var1=1&var2=1&var3=2&var4=3&var5=4

    when you load this up using the loadVar object...all those variables are associated with the myVars object (textFile).

    so on each frame..you can call a different variable

    frame 1 code:
    textField.text = myVars.var1;

    frame2 code:
    textField.text = myVars.var2;

    frame3 code:
    textField.text = myVars.var3;

    etc..etc..

    using a varObject is easy..if you have any question..post.

  3. #3
    cheers ilgive it a go, i need it to be an actual vairable im changing not a text field but i might be able to work it out from what you have given me and ill give the site a read.

    Cheers Slaup

  4. #4
    sorry i have had a read and i need the text to go into a vairable (actionScript) not on the stage, ill keep trying to sort this but if you could point me in the right direction that would be very helpfull, cheers again

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