我想將一個URL/GET變量加載到AS3中使用的FlashVar中。它只是在AS3中追溯到未定義。Flashvars不會通過SWFObject在AS3中註冊
這裏是我的JS($ _ GET [ '建築']設置的東西和回聲出正確):
<script type="text/javascript" src="<?php echo site_url(); ?>js/swfobject.js"></script>
<script type="text/javascript">
<?php if(isset($_GET['building'])){ ?>
var flashvars = { building: '_<?php echo $_GET['building']; ?>' };
<?php } else { ?>
var flashvars = { };
<?php } ?>
var params = {};
var attributes = {};
swfobject.embedSWF("PlanEventTool_cs5-1.swf", "flashContent", "900", "700", '9.0.0', '<?php echo site_url(); ?>js/expressInstall.swf', flashvars, params, attributes);
</script>
我的AS3:
var allFlashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;
buildingString = String(allFlashVars['building']);
trace(buildingString);
一直在研究這個了而我相信我錯過了一些小事。
任何想法?
渲染JS:
var flashvars = { };
flashvars.building = "_grandstand";
var params = {};
var attributes = {};
var flashObj = "PlanEventTool_cs5-1.swf?t=" + new Date().getTime(); // anti-cahce
swfobject.embedSWF(flashObj, "flashContent", "900", "700", '9.0.0', 'expressInstall.swf', flashvars, params, attributes);
渲染HTML:
<object width="900" height="700" type="application/x-shockwave-flash" data="PlanEventTool_cs5-1.swf?t=1334695440505" id="flashContent" style="visibility: visible;"><param name="flashvars" value="building=_grandstand"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="AllowNetworking" value="all"></object>
發佈呈現的HTML代碼 – 2012-04-17 20:10:43
此外,您還沒有使用任何形式的反高速緩存,因此可能也是一個問題。 – 2012-04-17 20:16:49
這是呈現的HTML。我試過在不同的瀏覽器/會話中,所以它不應該被緩存。 – adamzwakk 2012-04-17 20:18:01