Read request URL in Flash

巧了我就是萌 提交于 2019-12-24 19:02:08

问题


I am not a flash developer, but I am stuck with a flash developer, stuck with a third party program in ActionScript1.

I asked him to get the request URL of the page which embeds the flash object (like reading the address bar in the browser). and then get Query string variables and send it back to an application.

How to read those variables? Remember it is action script1.

Thanks


回答1:


Do you have control over how the movie is embedded? If so just add that information to the flash vars that you embed the movie with and reference it that way.




回答2:


Actually I used javascript like this, thanks

<script type="text/javascript">
        function writeFlash()
        {
            var id = '';

            var queryString = new String();
            queryString = window.location.search;

            if (queryString != null)
            {
                var parts = new Array();
                parts = queryString.split("&");

                parts = parts[0].split("=");
                id = parts[1];

            }



            var ieObj = '<div id="flashContent">'
            + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="1200" height="800" id="BookFlipping" align="middle">'
            + '<param name="movie" value="BookFlipping.swf" />'
            + '<param name="quality" value="high" />'
            + '<param name="bgcolor" value="#ffffff" />'
            + '<param name="play" value="true" />'
            + '<param name="loop" value="true" />'
            + '<param name="wmode" value="window" />'
            + '<param name="scale" value="showall" />'
            + '<param name="menu" value="true" />'
            + '<param name="devicefont" value="false" />'
            + '<param name="salign" value="" />'
            + '<param name="allowScriptAccess" value="sameDomain" />'

            + '<PARAM NAME="FlashVars" VALUE="ID='
            + id
            + '"/>'

            + '<!--[if !IE]>-->'
            + '<object type="application/x-shockwave-flash" data="BookFlipping.swf" width="1200" height="800">'
            + '<param name="movie" value="BookFlipping.swf" />'
            + '<param name="quality" value="high" />'
            + '<param name="bgcolor" value="#ffffff" />'
            + '<param name="play" value="true" />'
            + '<param name="loop" value="true" />'
            + '<param name="wmode" value="window" />'
            + '<param name="scale" value="showall" />'
            + '<param name="menu" value="true" />'
            + '<param name="devicefont" value="false" />'
            + '<param name="salign" value="" />'
            + '<param name="allowScriptAccess" value="sameDomain" />'

            + '<PARAM NAME="FlashVars" VALUE="ID='
            + id
            + '"/>';

            + '<!--<![endif]-->'
            + '<a href="http://www.adobe.com/go/getflash">'
            + '<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />'
            + '</a>'
            + '<!--[if !IE]>-->'
            + '</object>'
            + '<!--<![endif]-->'
            + '</object>';

            //alert(ieObj);
            document.write(ieObj);


        }
    </script>


<body>

    <script language="JavaScript" type="text/javascript">
    <!-- 
    writeFlash();
    -->
    </script> 


</body>



来源:https://stackoverflow.com/questions/5296923/read-request-url-in-flash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!