Flash querystring
- Started
- Last post
- 14 Responses
- ukit
I'm having trouble getting Flash to read in special characters (apostrophe and &) from a variable in the querystring. Is there a way to solve this?
- chrisRG0
are you reading it from an external file, like an xml?
if so, I solved it by replacing these characters for:
& = &
" = "
' = '
- chrisRG0
damn
& = & amp; (of course without the space)
- 7point340
can you escape them ?
\& ?
- ukit0
Reading it from the HTML i.e.,
myswf?myVariable=1
I can get data read in from XML to work but not from this for some reason
- chrisRG0
is this flashvars? I didn't get it, r u trying send or load the data?
- maximillion_0
if your using swfObject then you need to pass it as a defined variable in the javascript
so.addVariable("varName", "varValue");
its then available to the _root.varName (as2) or root.loaderInfo.parameters.varNa... (as3)
- kult0
- kingsteven0
you need to use urlencode() in php or something... "&" is used to join querys so you obviously cant put it in the strings themselves.
<?php echo urlencode("lindstrom & prins thomas"); ?>
returns: "linstrom%20%26%20prins%20thomas...
- kult0
It sounds like he's already being passed an encoded string in that format, and has no idea how to parse it. If that is indeed the case, decodeURI handles that.
- On second glance, I have no idea what ukit even meanskult
- decodeURIComponent() you mean? I find it wierd that he would be passing a full query string...kingsteven
- or that he'd be using AS3 :-Dkingsteven
- chrisRG0
1) are you trying to send these vars to your swf in the same html page you are embedding it? (which i think so, and it is flash vars)
2) or are you trying to load the data from your swf in from another html page?
3) neither ;-)
- acescence0
kingsteven has the right answer there, you need to use percent and the two digit hex value
- monNom0
use %26 for ampersand. Apostrophes might be a problem, can you substitute single prime? -> '
- acescence0
a proper apostrophe is %80