在 Internet Explorer 上播放 swf 文件时出错
在下面的代码中,我收到一条错误消息 Error #2007: Parameter url must be non-null on Internet Explorer only. 我在这里做错了什么
html
<OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="50"
HEIGHT="50"
id="myMovieName">
<PARAM NAME="movie" VALUE="/media/players/testsound.swf" />
<PARAM NAME="quality" VALUE="high" />
<PARAM NAME="bgcolor" VALUE="#FFFFFF" />
<EMBED
href="/media/players/testsound.swf"
src="/media/players/testsound.swf"
flashvars="soundUrl=sound.mp3"
quality=high
bgcolor=#FFFFFF
NAME="myMovieName"
ALIGN=""
TYPE="application/x-shockwave-flash">
</EMBED>
</OBJECT>
mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="10" minHeight="10">
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.display.InteractiveObject;
import flash.display.Sprite;
import flash.media.*;
import flash.net.*;
import mx.controls.Alert;
import mx.controls.Button;
import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
private function clickhandler(event:Event):void
{
var musicfile:String;
var s:Sound = new Sound();
//var req:URLRequest = new URLRequest(musicfile);
s.load(req);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!--<mx:Button id="play" label="PLAY" click="clickhandler(event)" />-->
<mx:Image id="loader1" source="@Embed(source='/opt/cloodon/site/media/img/speaker.gif')" click="clickhandler(event)" />
</s:Application>
In the below code i get an error saying Error #2007: Parameter url must be non-null on Internet Explorer only.What am i doing wrong here
html
<OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="50"
HEIGHT="50"
id="myMovieName">
<PARAM NAME="movie" VALUE="/media/players/testsound.swf" />
<PARAM NAME="quality" VALUE="high" />
<PARAM NAME="bgcolor" VALUE="#FFFFFF" />
<EMBED
href="/media/players/testsound.swf"
src="/media/players/testsound.swf"
flashvars="soundUrl=sound.mp3"
quality=high
bgcolor=#FFFFFF
NAME="myMovieName"
ALIGN=""
TYPE="application/x-shockwave-flash">
</EMBED>
</OBJECT>
mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="10" minHeight="10">
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.display.InteractiveObject;
import flash.display.Sprite;
import flash.media.*;
import flash.net.*;
import mx.controls.Alert;
import mx.controls.Button;
import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
private function clickhandler(event:Event):void
{
var musicfile:String;
var s:Sound = new Sound();
//var req:URLRequest = new URLRequest(musicfile);
s.load(req);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!--<mx:Button id="play" label="PLAY" click="clickhandler(event)" />-->
<mx:Image id="loader1" source="@Embed(source='/opt/cloodon/site/media/img/speaker.gif')" click="clickhandler(event)" />
</s:Application>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
另外,请检查这篇文章以了解 Flex 方面的内容:
Peter de Haan 关于从 Flex 获取 FlashVars 的博客文章
Try:
Also, check this post for the Flex side of things:
Peter de Haan's blog post on grabbing FlashVars from Flex
上面提供了更正的代码。
您错过了对象标签的 soundUrl 参数。 IE 使用这个标签,IE 不会打扰你在 EMBED 中放入的内容。
所以,我只是将其添加到您的代码中,没有其他任何更改:
Corrected code is provided above.
You missed the soundUrl parameter for the object tag. IE uses this tag, IE does not bother what you put in EMBED.
So, I just added this to your code, nothing else changed: