views:

448

answers:

1

I have created a simple flash menu and the SWF file, JS files (swfoject.js and flying.js) & XML files are in a folder called "icpmenu_es" on the server root. If I open the SWF file on my local HDD it works fine but if I alter the paths to the files for use on my website, it won't work at all. I know it has found the JS files because if I put an incorrect path in it comes up with the message saying that I need to install Flash or allow JS to access the menu. The code is as follows:

<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="keywords" content="" /> <meta name="description" content="TEST" /> <meta http-equiv="Content-Language" content="es" /> <base href="http://www.ideal-country-property.com/"&gt;&lt;/base&gt; <title> TEST | Ideal Country Property S.L.</title>
<script type="text/javascript" src="icpmenu_es/swfobject.js"></script>
<script type="text/javascript" src="icpmenu_es/flying.js"></script></HEAD><BODY> <!-- ICP www.ideal-country-property.com -->
<div id="ICPmessage" style="position:absolute; top:100px; padding-left:0px; z-index:0;">
    You need to upgrade your Flash Player or to allow javascript to enable Website menu. </br>
    <a href="http://www.adobe.com/go/getflashplayer"&gt;Get Flash Player</a>            
</div>
<script type="text/javascript">
// <![CDATA[
    var so = new SWFObject("icpmenu_es/menu.swf", "menu", "185", "440", "8", "#000000");
    so.addVariable("page_code", "a_b_c");

    so.addParam("wmode", "transparent");
    so.addParam("scale", "noscale");
    so.addParam("salign", "TL");
    so.write("ICPmessage");
// ]]>
</script></BODY></HTML>

Any help would be much appreciated as this is driving me crazy and it seems such a simple thing. By the way, if I change the BASE attribute to the icpmenu_es folder then it works as all the src links just have the "filename" and not the path. However, I can't change the BASE attribute to this folder as I have other scripts running on our Website in different locations and it would then mess these up! Thanks in advance for your help. Chris.

A: 

Once you put this on your web server preceeding the path with / will mean that anything that wishess to access it will go to the root of the domain,

/yourfolder/javascript.js

if you simply use

yourfolder/javascript.js

and for example, your current path on your site is

www.yoursite.com/members

then that relative path will be translated into

www.yoursite.com/members/yourfolder/javascript.js

So using absolute, it will always know to go to the root of your site to file the files!

UPDATE:


Use the following markup and test

<HTML> 
<HEAD> 
    <title>ICP Spanish Menu</title> 
<base href="http://www.ideal-country-property.com"&gt;&lt;/base&gt;  
    <script type="text/javascript" src="/icpmenu_es/swfobject.js"></script> 
    <script type="text/javascript" src="/icpmenu_es/flying.js"></script> 
  </HEAD> 
<BODY> 
<!-- ICPmessage www.ideal-country-property.com --> 
    <div id="ICPmessage" style="position:absolute; top:100px; padding-left:0px; z-index:0;"> 
        You need to upgrade your Flash Player or to allow javascript to enable Website menu. </br> 
        <a href="http://www.adobe.com/go/getflashplayer"&gt;Get the FREE Flash Player from Adobe</a>            
    </div> 
<div id="menu"></div>
    <script type="text/javascript"> 
    // <![CDATA[
        var so = new SWFObject ("/icpmenu_es/menu.swf", "menu", "185", "440", "8", "#000000");
        so.addVariable("page_code", "a_b_c");

        so.addParam("wmode", "transparent");
        so.addParam("scale", "noscale");
        so.addParam("salign", "TL");
        so.write("ICPmessage");
    // ]]>
    </script> 
</BODY> 
</HTML>
REA_ANDREW
Hiya. Thanks for that fast reply. I've put in the "/" but still no joy. It's on the server and you can see it here: http://www.ideal-country-property.com/es/test It doesn't display anything but you can see the SWF container if you select the background with the cursor.
Stoffer
You need a div with id="menu" as that is the container you have specified, but it does ot exist so it doe snot know where to put it and so doesn't
REA_ANDREW
Used your corrected markup but still nothing as yet. As for the container you mentioned, that is the code that the menu program generates so I'll take your word for it! ;)
Stoffer
My istake, did not read that mark up correctly. If I view in firefox, the error console give a permissions error with /icpmenu_es/flying.jsTry removing that js reference and try it!
REA_ANDREW
No problem Andrew. Reference removed. To see the flying.js file try this: http://www.ideal-country-property.com/icpmenu_es/flying.jsNow you can see why this is driving me mad. It should be a snap to get this SWF up and running.
Stoffer
Thanks to help from the Google group SWFObject, I have found the root of the problem. In ModX we have to put in the "document's alias" field (under the "General" tab the name of the page plus an "_en" or "_es" depending on whether the page is in English or Spanish. This then creates an alias link for the page. In this case, the alias of my test page is "test_es" so that produces a link of ideal-country-property.com/es/test. When insert the SWF code, the SWF file finds the JS files OK but is trying to find the XML files in a folder called "ES", which doesn't exist.
Stoffer
By the way, You can follow the history of this in Google Groups: http://groups.google.com/group/swfobject/browse_thread/thread/6bc280b258e4ecff/3b661c1ae996afd1#3b661c1ae996afd1Our ISP, who also provide our Real Estate software setup ModX like this (as with all their Real estate clients) so I don't really want to mess with it too much. I just need a way for the SWF to access the XML file correctly and not look for it in a virtual "ES" folder.Hope this is clear.Cheers. Chris.
Stoffer