I'm having some problems inserting my ammap (http://www.ammap.com/) into my webpage. I've read through the documentation and it isn't helping. The map works with if I use the .html file in my original folder but all the paths are relative and I'm trying to make this work in an ASP.NET MVC project using visual studio. It's rather tough to explain the problem since I don't know what's wrong (no javascript or flash debugger).
Here is the code that embeds the ammap:
<script type="text/javascript" src="../../Content/AlcoholAndWar/WarStuff/ammap/swfobject.js"></script>
<div id="flashcontent">
<strong>You need to upgrade your Flash Player</strong>
</div>
<script type="text/javascript">
var so = new SWFObject("../../Content/AlcoholAndWar/WarStuff/ammap/amtimeline.swf", "amtimeline", "800", "600", "8", "#dddddd");
so.addVariable("path", "../../Content/AlcoholAndWar/WarStuff/ammap/"));
//The data file links to the settings file.
//so.addVariable("settings_file", encodeURIComponent("../../Conten开发者_JAVA技巧t/AlcoholAndWar/War stuff/map/War/ammap_settings.xml"));
so.addVariable("data_file", "../../Content/AlcoholAndWar/WarStuff/map/War/timeline_data.xml");
so.write("flashcontent");
</script>
To better understand the problem, here is the folder structure in visual studio (irrelevant files/folders skipped) :
-Content
-AlcoholAndWar
-Alcohol
-Warstuff
-ammap
swfobject.js
-icons
-maps
-map
-War
timeline_data.xml
ammaps_settings.xml
I think the links to the files and folder are causing the problem but I can't know for sure. FYI, an flash object does appear on my site but is only displays "Loading 0%" and ultimately crashes.
I know this is a very specific problem but I figured I'd try asking you guys since I've spent a lot of time fixing this and google isn't very helpful.
And I've tried entering: "http://localhost:portNumber/Content/AlcoholAndWar/WarStuff/map/War/timeline_data.xml" into my browser and it doesn't show but it's visible through "View page source".
At first I advise to use absolute path's begin with a /
or use Html.Content("~/Content/..")
(in Case of MVC 3).
In case of your Flash embedding, Flash uses relative path's relatively to the URL where the swf is called from. In an MVC application you have path like /Area/Controller/Action
. The embedded flash will now try to go from there to your relative target. If you specify an absolute URL flash will go from /
.
I would try
<script type="text/javascript" src="/Content/AlcoholAndWar/WarStuff/ammap/swfobject.js"></script>
<div id="flashcontent">
<strong>You need to upgrade your Flash Player</strong>
</div>
<script type="text/javascript">
var so = new SWFObject("/Content/AlcoholAndWar/WarStuff/ammap/amtimeline.swf", "amtimeline", "800", "600", "8", "#dddddd");
so.addVariable("path", "/Content/AlcoholAndWar/WarStuff/ammap/"));
//The data file links to the settings file.
//so.addVariable("settings_file", encodeURIComponent("/Content/AlcoholAndWar/War stuff/map/War/ammap_settings.xml"));
so.addVariable("data_file", "/Content/AlcoholAndWar/WarStuff/map/War/timeline_data.xml");
so.write("flashcontent");
</script>
Last advice. Use Firebug and have a look at the Network panel. There you will see which item was not loaded correctly and in the Response Tab of a request you may be able to see the response from IIS (maybe an exception).
精彩评论