FlashVars QueryString

2019-08-07 12:28发布

问题:

I'm unclear on the proper format for passing a QueryString Value using FlashVars, this is what I'm trying

<param name="FlashVars" value="part=<%= Request.QueryString["part"] %>" />

but this causes a parse/encode error and the swf doesnt load, same if I use single quotes ie

<param name="FlashVars" value="part=<%= Request.QueryString['part'] %>" />

Any takers?

Cheers

回答1:

If you are working with HTML, use the variable itself:

<param name="FlashVars" value="part=valueOfPartGoesHere&anotherPart=anotherPartValueGoesHere" />

For embed tags (required for FF and other browsers):

<embed flashvars="part=valueOfPartGoesHere&anotherPart=anotherPartValueGoesHere" />

Fot this to be dynamic you have to run a PHP, ASP or other dynamic language/platform.

If you are using PHP, use:

<?php echo $_GET['part']; ?>

instead of

<%= Request.QueryString['part'] %>

For ASP:

<%= Request.QueryString("part") %>

And so on...



回答2:

expanding on rcdmk's answer, the value that flashvars expects is just a standard query string with keys and values a=b&c=d&so_on=so_forth.

What you have shown in your code is that you're having some engine insert some value into your HTML renderer. That's fine, but then you need to show a sample of what this substitution will produce. If it's not producing something that looks like the query above, then it won't work. And if it' producing something that has a quote in it, then obviously once it's being parsed it will choke on an incomplete tag (as your substitution will end the tag prematurely and throw everything into the crapper).