我正试图通过网页将MySQL的ssoTicket传递到SWF文件中。
波纹管代码在服务器日志中导致null,但是当我设置匹配的ssoTicket时,一切正常。
网上的信息似乎相对较少。
我已经打印了sso_ticket,它确实回显了正确的字符串。
网页
<?php
include("global.php");
if($islogged) { ?>
<?xml version=”1.0″?>
<html>
<head>
<title><?php echo $self['sso_ticket']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script src="js/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
var flashvars = {
sso: "<?php echo $self['sso_ticket']; ?>"
};
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "#FFFFFF"
};
var attributes = {
id:"E4"
};
swfobject.embedSWF("ac.swf", "altContent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<style>
html, body { height:100%; }
body { margin:0; }
</style>
</head>
<body>
<div id="altContent">
<p><a href="http://www.adobe.com/go/getflashplayer"><img
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player" /></a></p>
</div>
</body>
</html>
<?php
}
?>
SWF
var ssoTicket:String = LoaderInfo(this.root.loaderInfo).parameters["sso"];
SWF预设ssoTicket
var ssoTicket:String = LoaderInfo(this.root.loaderInfo).parameters["sso"];
if (ssoTicket == "" || ssoTicket == null) ssoTicket = "73a448e7e4a3314d2d1a3f33588df9b8";
答案 0 :(得分:0)
您的flashvars应该是一组name=value
对(由&
分隔的对,当前没有在您的示例中使用,但是如果您添加更多flashvars)。
所以这样的事情会起作用:
<script type="text/javascript">
var flashvars = {};
flashvars.sso = "<?php echo $self['sso_ticket']; ?>";
var params = {};
var attributes = {};
swfobject.embedSWF("ac.swf", "myAlternativeContent", "800", "600", "9.0.0", false, flashvars, params, attributes);
</script>
swfobject项目中有一个html生成器,您可以将所有值插入其中,它将生成静态或动态HTML代码,以便您剪切/粘贴到代码中(swfobjectgen.html)。
然后这应该在您的SWF中工作以分配您的票证#:
var ssoTicket:String = LoaderInfo(this.root.loaderInfo).parameters.sso;