如何将多个 Flashvars 变量放入 Flash(不使用 swfobject)
我正在为我的客户重建这个嵌入式播放器,视频文件 URL 和其他几个变量在 HTML 中为 Flashvars。我怀疑查找 flashvars 的代码有问题。
显示绿色框的顶部部分是播放器未加载的位置,因为它无法从 HTML 获取 Flashvars。下面的播放器将 Flashvars 字符串硬编码到播放器中,因此它可以工作。
我相信问题出在下面的某个地方,也许我尝试引入 Flashvars 的方式有问题?
// LIVE Embedded
//vidURL = stage.loaderInfo.parameters.fvar;
vidURL = this.loaderInfo.parameters.fvar;
fvarText.text = "vidURL = this.loaderInfo.parameters.fvar"
vidSplit = vidURL.split(".flv")[0].split("/");
varVid = vidURL.toLowerCase().split("&vid=")[1].split("&")[0];
varChid = vidURL.toLowerCase().split("&chid=")[1].split("&")[0];
// Hardcode Testing
//(This creates the player that works at the bottom of the test page)
/*vidURL = "http://";
vidSplit = vidURL.split(".flv")[0].split("/");
varVid = vidURL.toLowerCase().split("&vid=")[1].split("&")[0];
varChid = vidURL.toLowerCase().split("&chid
当我从以下位置导出时收到此错误Flash:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.Player::Embed/init()
at com.Player::Embed()
我预计会出现此错误,因为显然 Flash 尚未嵌入,但此错误是否可以解释为什么我的播放器无法获取 FlashVars 链接然后自行渲染?
HTML 嵌入代码:
<object width="640" height="395" border="0">
<param name="flashvars" value="fvar=http://360.flv&VID=1273&CHID=4" />
<embed src="http://dev.site.com/flash.swf" width="640" height="395" flashvars="fvar=http://360.flv&VID=1273&CHID=4">
</embed>
</object>
I'm rebuilding this embedable player for a client of mine, the video file URL and a couple of other variables are in the HTML as Flashvars. I suspect something is wrong with the code that looks for the flashvars.
The top part showing the green box is where the player didn't load because it was unable to obtain the Flashvars form the HTML. The player below has the Flashvars string hardcoded into the player so it works.
I believe the problem lies somewhere below Perhaps something wrong with the way I'm trying to pull in the Flashvars?
// LIVE Embedded
//vidURL = stage.loaderInfo.parameters.fvar;
vidURL = this.loaderInfo.parameters.fvar;
fvarText.text = "vidURL = this.loaderInfo.parameters.fvar"
vidSplit = vidURL.split(".flv")[0].split("/");
varVid = vidURL.toLowerCase().split("&vid=")[1].split("&")[0];
varChid = vidURL.toLowerCase().split("&chid=")[1].split("&")[0];
// Hardcode Testing
//(This creates the player that works at the bottom of the test page)
/*vidURL = "http://";
vidSplit = vidURL.split(".flv")[0].split("/");
varVid = vidURL.toLowerCase().split("&vid=")[1].split("&")[0];
varChid = vidURL.toLowerCase().split("&chid
I get this error when I export from Flash:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.Player::Embed/init()
at com.Player::Embed()
I expect this error however since obviously the Flash isn't embedded yet, but could this error shed any light on why my player isn't able to get the FlashVars link and then render itself?
The HTML embed code:
<object width="640" height="395" border="0">
<param name="flashvars" value="fvar=http://360.flv&VID=1273&CHID=4" />
<embed src="http://dev.site.com/flash.swf" width="640" height="395" flashvars="fvar=http://360.flv&VID=1273&CHID=4">
</embed>
</object>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在对象和嵌入标签中设置 flashVars 参数。查看此链接 http://livedocs.adobe。 com/flex/3/html/help.html?content=passingarguments_3.html
在 Flash 中获取值。使用这个:
You need to set the flashVars param in both the object as well as the embed tag. Check out this link http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_3.html
To get values inside Flash. Use this:
正如 George 所说,您可以尝试对 和 标签使用 flashvars。另外,我引用我的属性值并转义我的与号 (&)。以下代码应该可以工作:
Like George said, you could try using flashvars for both the and tag. Also, I quote my attribute values and escape my ampersand (&). The following code should work: