Search code examples
actionscript-3flashapache-flexflash-builderflex4.5

String flashvar coming out as [Object object] rather than string


I'm sending

flashvars.location = "xml/";

But it's ending up as:

  [object Object]

when I try to use it.

Here's how I assign it and use it.

xmlLocation =  (FlexGlobals.topLevelApplication.parameters.location) ? FlexGlobals.topLevelApplication.parameters : "";

myLoader.load(new URLRequest(xmlLocation.toString() + "service.xml"));

How can I make this a string?


Solution

  • The problem is that you are making an incorrect assignment.

    When your ternary expression is true, you set the variable xmlLocation equal to FlexGlobals.topLevelApplication.parameters. So now xmlLocation is the parameters object, not the String you are expecting. Instead do this:

    xmlLocation =  (FlexGlobals.topLevelApplication.parameters.location) ?
        FlexGlobals.topLevelApplication.parameters.location : "";