A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Variables schmariables.

  1. #1
    Old man of minimal posts
    Join Date
    Jul 2000
    Location
    Nottingham, UK
    Posts
    230
    Righto.

    I'm having trouble getting my Flash movie to "act" upon variables imported from text files.

    I can get a variable set within the Flash movie to work e.g:

    spam = "2";
    if (spam>1) {
    tellTarget ("spammovieclip") {
    gotoAndStop (5);
    }
    }

    I can also load variables from text files without any problems.

    What I want to do, is load a variable from a text file, (lets call the variable "textitems")

    Then dependent upon the value of the variable textitems, go to a certain frame within a movie clip, and act upon the variable.



    Any ideas?

    Thanks in advance

    H

  2. #2
    Infinite Loop grvdgr's Avatar
    Join Date
    Feb 2001
    Posts
    610
    Hmmmm, could you eval the loaded variables like this.....

    button ex

    OnRelease
    if (testitems==whatever)
    goto (frame number, _root.yourMC)

    Just guessing

    Hope it helps

    GrvDgr

  3. #3
    Old man of minimal posts
    Join Date
    Jul 2000
    Location
    Nottingham, UK
    Posts
    230
    Tried it, but it doesn't seem to work!

    Any ideas????


  4. #4
    Infinite Loop grvdgr's Avatar
    Join Date
    Feb 2001
    Posts
    610
    Try this one, notice the subtle diff in code? I left out the quotes, maybe that will help.

    on (release) {
    ;
    if (textitems=="whatever")
    gotoAndPlay ("Scene",frame,_root.yourMC);
    )

    Where are you loading the "textitems" variable too? You would need to eval where it is loaded to, example... "textfield"

    Hope that helps

    GrvDgr

  5. #5
    Old man of minimal posts
    Join Date
    Jul 2000
    Location
    Nottingham, UK
    Posts
    230
    Originally posted by grvdgr
    Try this one, notice the subtle diff in code? I left out the quotes, maybe that will help.

    on (release) {
    ;
    if (textitems=="whatever")
    gotoAndPlay ("Scene",frame,_root.yourMC);
    )

    Where are you loading the "textitems" variable too? You would need to eval where it is loaded to, example... "textfield"

    Hope that helps

    GrvDgr
    I'm trying to load the variable from the text file into wherever I can. I've tried loading I've tried loading it into level_0 and also into a movie clip to do the eval.

    I'm stuck!


  6. #6
    Infinite Loop grvdgr's Avatar
    Join Date
    Feb 2001
    Posts
    610
    Hmmm,just to test, try to eval them from a text field.....

    Make a dynamic text box, named "textfield"

    at the top of your text file, put ... textfield=

    frame 1 of your movie

    loadVariablesNum ("http://yoursite.com/textitems.txt", 0);


    eval from the text field.....

    on (release) {
    ;
    if (textfield=="whatever")
    gotoAndPlay ("Scene",frame,_root.yourMC);
    )

    Hope that helps

    GrvDgr
    http://caveart.tv

  7. #7
    Old man of minimal posts
    Join Date
    Jul 2000
    Location
    Nottingham, UK
    Posts
    230
    Maaaan, I'm being daft. - Forgetting to make the variable literal rather than expressional. . .


    How long have I been using Flash again?????


    Thanks for the help dude.


    H

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