====== Adding a map to a page ====== The simplest way to include a map to a page is to take the code from the ammap.html file. This file came in the ammap package you downloaded from the ammap.com website and extracted. - Copy the "ammap" folder with all contents to the location where your HTML (PHP, ASP...) file is. - Open the ammap.html file in Notepad. - Find the rows that say and . - Select everything between these two bits of text. - Copy the text to the Clipboard. - Open your page with your editor. - Paste the copied text into your web page, in the place where you want it to go. - Save the file. - Open your web page in your browser. You should now see the map. If you don't see the map, but the text "You need to upgrade your Flash Player" appears instead, don't hurry to download a Flash player update. This text is also displayed if the page can't find the swfobject.js file. This means that you might have changed the name of the ammap folder, or placed it somewhere different from the path included in the HTML code. Check this and try again. ====== Sample code ====== Here is a copy of the example code. If you haven't renamed any of the files or folders, you can simply copy this code into your web page.
You need to upgrade your Flash Player
The first part of the code creates the Flash object on the web page: var so = new SWFObject("ammap/ammap.swf", "ammap", "900", "600", "8", "#444444"); * "ammap/ammap.swf" – the path to the SWF (Flash) file. * "ammap" – Flash object ID. Useful if you are using Javascript controls and there are multiple Flash objects on the page. * "900" – the width of the Flash object, in pixels. You can also use a percentage of the page width as a value, such as "100%" * "600" – the height of the Flash object, in pixels. You can also use a percentage of the page width as a value, such as "100%". * "8" – the version of the Flash player required to view the map. If the viewer doesn’t have this version or newer, the browser will give them a link to download it. * "#444444" – the background color of the chart. You can set this in the settings file as well, but the color specified here will be shown until the settings file is loaded. And here is what the other lines do: --------------------- **so.addVariable("path", "ammap/");** This line tells the ammap.swf where it should look for all the additional files, such as maps, export as image files, icons. Do not forget to add "/" at the end of this line. --------------------- **so.addVariable("settings_file", escape("ammap/ammap_settings.xml"));** This line tells ammap.swf the name of a settings file. The map can have [[v.2:settings:multiple_settings_files|more than one setting file]]. --------------------- **so.addVariable("data_file", escape("ammap/ammap_data.xml"));** This line tells ammap.swf the name of a data file. Some of the following lines have // at the front of them. This means that they are not used. If you want to use them, delete the //. --------------------- **so.addVariable("map_data", "");** This line is used for including [[v.2:data:data_inside_html|data directly in the HTML file]] instead of loading it from an external file. --------------------- **so.addVariable("map_settings", "");** This line is used for including [[v.2::settings:settings_inside_html|settings directly in the HTML file]] instead of loading them from an external file. --------------------- **so.addVariable("additional_map_settings", "");** This line is used for [[v.2:settings:settings_inside_html|appending settings]] to the ones you loaded from a file or set with the map_settings (the line above). --------------------- ** so.addVariable("loading_settings", "LOADING SETTINGS");** If you want to change the "Loading settings" text that is displayed while the settings are loaded, you can set your own text here. --------------------- ** so.addVariable("loading_data", "LOADING DATA");** If you want to change the "Loading data" text that is displayed while the data is loaded, you can set your own text here. --------------------- ** so.addVariable("preloader_color", "#999999");** The loading bar and text of a loading message can be set here. --------------------- ** so.write("flashcontent");** This line tells swfobject.js to write to the script. Note that "flashcontent" must be the same as in this line (in the top part of the code):
In this example, flashcontent is an ID of your div, which should be unique for [[multiple maps on one page|every map on the same page]]. This ID can't start with a number.