3 Replies Latest reply on Dec 14, 2006 12:48 PM by Nephthys101

    Integer to String??

    Chaz03
      I am trying to pass variables either from an external TXT file or from the HTML into flash. The passing seems to be working. The problem is that the variable that I'm trying to pass is an integer (ie. 9999) and I am trying to eventually concatenate a URL string with this variable to make one URL (ie. 'getURL(generalURL+passedinURL,"_blank");'). I tried using this code prior to the getURL:
      var passedinURL:String = String(passedinINTEGER);
      But it gave me the same error when the button was clicked on the website.
      Can anyone help me out??

      Thanks in advance!
      Chaz
        • 1. Re: Integer to String??
          Nephthys101
          If you want to use a number strictly as a string you could try using something like

          var passedinURL:String = passedinINTEGER.toString();

          Bearing in mind integer is simply a type of number, not an actionscript class in itself.

          To be honest, even if passedinINTEGER is a strict number type, getURL(generalURL+passedinURL,"_blank") ought to still work. Did when I tested it anyway. If you're getting error messages I suspect the problem is with the parsing of the loaded variables. What is the error message you've been getting?

          :: Nephthys
          • 2. Re: Integer to String??
            Chaz03 Level 1
            Thanks, I'm going to try it some more your way. Here is the error I get on the webpage:

            A critical error has occurred.
            Cast from string "" to type 'Integer' is not valid.
            • 3. Re: Integer to String??
              Nephthys101 Level 1
              How are you getting your variables into Flash? Certainly if you're using loadVars to load the 'integer' from a text file, it is actually loaded as a string, even if the content is just numeric. The error message sounds like a PHP or Visual Basic error to me, though you'd be better off hearing from someone who actually knows what they're talking about...

              Have you tried doing a

              trace(passedinURL);
              trace(passedinINTEGER);

              and testing within Flash, to make sure you're getting what you expect? It would be useful to see more of your actionscript to see how you're doing this.

              :: Nephthys