Search code examples
htmlapache-flexactionscript-3mxmlmxmlc

Error in playing a swf file on internet explorer


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>

Solution

  • <OBJECT
        classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        WIDTH="50"
        HEIGHT="50"
        id="myMovieName">
    
        <PARAM NAME="soundUrl" VALUE="sound.mp3" />
        <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>
    

    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:

    <PARAM NAME="soundUrl" VALUE="sound.mp3" />