2 Replies Latest reply on Jun 7, 2007 9:01 AM by Newsgroup_User

    Load External Variable

    Yue_Hong Level 1
      I am trying to do with the function that Flash read the variable from external file (txt) with loadVariablesNum(). However, right now I am only success make it read variables from external file (e.g. myRotation=45&mySize=150). How can I make the external file store a multi-Array?
        • 1. Re: Load External Variable
          kglad Adobe Community Professional & MVP
          you can't. text files can only store variable and strings.

          after loading is complete you can store your variables in an array.
          • 2. Re: Load External Variable
            Level 7
            as an alternative, you can use a delimited string that can be parsed
            into an array. The example below uses a pipe ( | ) and caret ( ^ )
            delimited string to define a 2D array...

            your text file contains :

            myArrayDef=element0_var1^element0_var2|element1_var1^element1_var2|element2_var1^element2_ var2

            once this string is received you simply parse it into a 2D array...

            my2D_array = new Array()
            my2D_array = myArrayDef.split("|");
            for ( i = 0; i < my2D_array.length; i++ )
            {
            my2D_array = my2D_array.split("^");
            }



            kglad wrote:
            > you can't. text files can only store variable and strings.
            >
            > after loading is complete you can store your variables in an array.