tags:

views:

389

answers:

0

Hello everyone, This is the first time i have posted, so here goes:

I load swfs into my HTML two different ways. the first way is they are embedded directly into the page when it loads. The second way is when any link on the navigation bar is selected it removes the swf in the "flashcontent" div and replaces it with a different one and so on, and this works great as well because most of the swf files are small in size, however i have some large swf files in my examples/bim models and they have a built in pre-loader place on the 1st clip and they work fine on there own as well, however when i load them via my Main JavaScript code (Navigation) they are only visible after they have been 100% loaded. The first jpg and the pre-loader should show up immediately and display the preloading process.

I need to properly implement the snippet swfobject.switchOffAutoHideShow(); in my Main JavaScript code for this to work correctly and that what i am having problems with.

***MAIN SCRIPT CODE:***
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 (swfobject.hasFlashPlayerVersion("9")){

var attributes = { data:url + "?" + new Date().getTime(), id:"flashcontent", width:"975", height:"575", type:"application/x-shockwave-flash" }; var params = { menu:"false", //enablejs:"true", //javascriptid:"flashcontent", quality:"best", base:".", bgcolor:"#5B5B5B", allowNetworking:"all", //wmode:"transparent", allowScriptAccess:"always"///always///sameDomain///never/// //allowfullscreen:"false"

  };
    swfobject.switchOffAutoHideShow();

var obj = swfobject.createSWF(attributes, params, targetID) } }

I did a test and placed the large swf file on my home page to load when the HTML is called and it works great. but i think its because of the snippet below:

swfobject.switchOffAutoHideShow();

end of snippet:

***HOME PAGE EMBED CODE:***
<script type="text/javascript">
swfobject.switchOffAutoHideShow();
var params = {
        bgcolor:"#5B5B5B"
      };
var attributes = {
 allowScriptAccess:"always",
 menu:"false",
 quality:"best"
           }
swfobject.embedSWF("flash_files/home.swf?" + new Date().getTime(), "flashcontent", "975", "575", "9.0.0","expressInstall.swf", null, params, attributes);
</script>

I guess my question is how can I implement the snippet above into my main script code like I have it in my home page embed code? I have tried every way I can think but it doesn’t work. On the main page code above I put the snippet were I tried it first but it doesn’t work there.

Thank you in advance to anyone that can shed some light on my problem.

PhilBuilt