简体   繁体   中英

SWFObject - How to embed SWF in a different folder to the html?

    <div id="flashContent">
        <h1>You need at least Flash Player 9.0 to view this page.</h1>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
    </div>

    <script type="text/javascript">
        //Dynamic publishing with swfObject 

        //A 'name' attribute with the same value as the 'id' is REQUIRED for Chrome/Mozilla browsers
        var flashvars = {};
        var params = {"base": "../flashgame_new/"};
        var attributes = {id: "iTag", name: "iTag"};
        swfobject.embedSWF("flashgame.swf", "flashgame", "720", "610", "9.0", null, flashvars, params, attributes);
    </script>
  • The html file's in the root.
  • It's trying to load 'iTag.swf' in '/iTag_FLASH_new/'
  • I tried entering the path in the swfURL parameter - embedSWF("/iTag_FLASH_new/iTag.swf" - and that didn't work, the file doesn't load
  • Some Googling told me it's because I had to specify the path by changing the base path as above - this doesn't work either, the file still doesn't load.

I'm probably just making a really daft mistake because I'm tired, but anyone got any suggestions? Cheers.

尝试在基本路径中删除“..”并引导“/”。

var params = {"base": "iTag_FLASH_new/"};

You don't need to specify the "base" tag, you can specify it as part of embedSWF.

by your information: the page is at: (http://blah/whatever.html) and the flash is at: (http://blah/iTag_FLASH_new/iTag.swf)

I would make sure the path the the swf loads correctly by going to it directly in the browser...

if your page is at: (http://blah/somedirectory/whatever.html) and the flash is at (http://blah/somedirectory/iTag_FLASH_new/iTag.swf)

you need to specify the path as "iTag_FLASH_new/iTag.swf", note the lack of slash.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM