开发者

Path referral from html to actionscript

In the below code how will in action script how will i say that the my mp3 is present is in the path specified in the html tag

       <div style="display: inline;float:center;">
       <OBJECT
                                     classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                                     WIDTH="50"
                                     HEIGHT="50"
                                     id="myMovieName">

                                   <PARAM NAME="movie" VALUE="mysound.swf" />
                                   <PARAM NAME="quality" VALUE="high" />
                                   <PARAM NAME="bgcolor" VALUE="#FFFFFF" />

                                   <EMBED
                                      href="mysound.swf"
                  src="mysound.swf"
                  flashvars="soundUrl=/var/mychannel/sound.mp3"
                                      quality=high
                                      bgcolor=#FFFFFF
                                      NAME="myMovieName"
                                      AL开发者_运维百科IGN=""
                                      TYPE="application/x-shockwave-flash">
                                   </EMBED>
                                   </OBJECT>

            </div>

Actionscript code

<?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="955" minHeight="600">
<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 s:Sound = new Sound();
        s.addEventListener(Event.COMPLETE, onSoundLoaded);
        //var req:URLRequest = new URLRequest("sound.mp3");   
        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)"  />

</s:Application>


Try this: stage.loaderInfo.parameters.soundUrl or stage.loaderInfo.parameters["soundUrl"].

Rob

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜