5 Replies Latest reply on Jul 13, 2007 2:34 PM by SymTsb

    URLLoaderDataFormat

    SymTsb Level 2
      AS3 question

      I have an old AS2 file that loaded content from a server side php script. I'm updating the file using AS3 and have run into a bit of a snag.

      When I use URLLoaderDataFormat.VARIABLES I get an error that URLVariables.decode() is expecting name value pairs. The output from the php file is...

      specials=" {some html text here} "

      I've attached my code minus the link to the php file

      If I run the file with URLLoaderDataFormat set to TEXT, I don't have an issue getting the data out but I'm left with specials= at the start. As far as I knew, specials="somestuff" was a variables/content pair. What the flip am I doing wrong?
        • 1. Re: URLLoaderDataFormat
          SymTsb Level 2
          bump

          kglad or anyone? This is a huge problem for me and I'd like to get it resolved soon.... ANY help is appreciated.
          • 2. Re: URLLoaderDataFormat
            Greg Dove Level 4
            I tried a local version of your code and it worked for me like this:

            _stext = loader.data.specials.split(",")

            you need to access each 'name' of your name/value pairs as a property of the data . Kind of like LoadVars I guess. But think of data as the owner of your name value pairs.

            • 3. Re: URLLoaderDataFormat
              Greg Dove Level 4
              Oh hang on... that's one thing.

              I think the other is that perhaps you're not escaping your quotation marks in the php...? That would leave you with just specials=
              e.g.
              echo "specials="something""

              will not work
              echo "specials=\"something\""
              will

              But you don't need the quotation marks unless you want them as part of your string value.
              echo "specials=something"
              will give you a string value of "something" (i.e. the string is something - with no quotation marks)
              • 4. Re: URLLoaderDataFormat
                SymTsb Level 2
                I'll look into that GWD. It makes sense but now it's just a matter of practical application.

                I had tried accessing specials as you recommended in the AS loader.data.specials.split(","); but I kept getting another error. I'll look at the php file and see what (if anything) I am able to fix for the output that is returned to flash.
                • 5. Re: URLLoaderDataFormat
                  SymTsb Level 2
                  Thanks GWD. It turns out it was an accident on my part that was working against me. I forgot a quote actually on the echo. I actually deleted it while editing it to work for AS3. I've got it working now in AS3. I appreciate the insight so that I knew I wasn't crazy.