I would like to know how i can make this code work?

function isObject(targetID){
   var isFound = false;
   var el = document.getElementById(targetID);
   if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
      isFound = true;
   }
   return isFound;
}
function replaceSwfWithEmptyDiv(targetID){
   var el = document.getElementById(targetID);
   if(el){
      var div = document.createElement("div");
      el.parentNode.insertBefore(div, el);
      swfobject.removeSWF(targetID);
      div.setAttribute("id", targetID)
   }
}
function loadSWF(url, targetID){
   if(isObject(targetID)){
      replaceSwfWithEmptyDiv(targetID);
   }
   if (swfobject.hasFlashPlayerVersion("9")) {
                var attributes = {
                                                data: url,
                                                data:url,
                                                width:"975",
                                                height:"575",
                                                
type:"application/x-shockwave-flash"};
                var params = {
                                                menu:"false",
                                                enablejs:"true",
                                                quality:"best",
                                                base:".",
                                        bgcolor:"#5B5B5B",
                                                allowNetworking:"all",
                                        //wmode:"transparent",
                                                allowScriptAccess:"always",
                                                allowfullscreen:"false"
                                        };

                var rand_no = Math.floor(1000*Math.random());
                var targetID = targetID + rand_no;
                var obj = swfobject.createSWF(attributes, params, targetID);
   }
}

I am trying to add a random number on the end of the swf so  my swf's
will not load from the cache.
My swfs change thts why i do not want them to load from the cache.
My home swf works fine with this code: (the first one to load to the
html page)

<script type="text/javascript">
swfobject.switchOffAutoHideShow();
                                                var params = {
                                                        bgcolor:"#5B5B5B",
                                                        };
                                                var attributes = {
                                                        
allowScriptAccess:"always",
                                                        menu:"false",
                                                        quality:"best",
                                                        }
var rand_no = Math.ceil(1000*Math.random());
swfobject.embedSWF("flash_files/home.swf?" + rand_no, "flashcontent",
"975", "575", "9.0.0","expressInstall.swf", null, params, attributes);
</script>

this loads from the server eveytime fine. (I have tested it!)
But as soon as i replace the swf with another it loads from the cache?

my site is http://www.philbuilt.info

any help is greatly appreciated.
PhilBuilt

-- 
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en.

Reply via email to