3 Replies Latest reply on May 19, 2007 5:10 AM by Newsgroup_User

    Using only part of a variable value

    Rectallinear
      I have a variable in my Flash that relates to a date. The variable values are always in the form of mmyy. Therefore a value of 0407 refers to April 2007, a value of 0505 refers to May 2005, and so on.

      I'm trying to figure out how to take the variable value and use only the first two digits to create a new variable with the value of the corresponding month.

      So for example, say the original variable is:

      issueDate = 0407

      I would like to find a way to have actionscript take the first two digits in the value (04) and create a new variable (issueMonth) with the value of the corresponding month (April). So the final result would be:

      issueMonth = "April"

      That way, if the value of the issueDate variable was 0405, 0410, or 0420, the value of the new issueMonth variable would always just be April.

      The whole point of this is so that I can take that original variable and create dynamic text like this:

      confirmation.text = "Thank you for reading our" + issueMonth + "issue.";

      Any help would really be appreciated.