2 Replies Latest reply on Aug 17, 2007 7:24 AM by Gorka Ludlow

    Change graphic from external data

      I am doing a flash game, like changing faces but get suck on the scripts.
      Please see the below scripts(I put them on the frame action) that is there any problem:
      loadVariables("data.txt", "_root");
      // loading external text file, to make change the "face" graphics.
      if (f="f1") {
      if (f="f2") {
      if (f="f3") {
      if (f="f4") {
      // call for action
      The scripts above doesn't work, anything that I missing? Also there will be more, like hair, nose, eyebrows, mouth etc., how can I write the scripts that works? Hope some one can help me. Thanks a lot.
        • 1. Change graphic from external data
          clbeech Level 3
          I don't know why you would be wanting to change the variable from a text file, that is not controled by the user in the Game, instead of having buttons in your Game that do this, but remove calls to _root and change the script to:

          loadVariables("data.txt", this);
          switch(f) {
          case "f1": face.gotoAndStop(1); break;
          case "f2": face.gotoAndStop(2); break;
          case "f3": face.gotoAndStop(3); break;
          case "f4": face.gotoAndStop(4); break;

          And your .txt file should then read:
          • 2. Re: Change graphic from external data
            Gorka Ludlow Level 1
            Your if statements are miswritten:

            if(f="14") should be if(f=="14")

            and yes it would be better to use a swicth.