# Swf works fine - won't play when placed on HTML page. Thoughts?

**URL:** <https://forum.kirupa.com/t/swf-works-fine-wont-play-when-placed-on-html-page-thoughts/287718>\
**Category:** Uncategorized\
**Created:** [May 5, 2009, 4:13pm UTC](https://forum.kirupa.com/t/swf-works-fine-wont-play-when-placed-on-html-page-thoughts/287718 "2009-05-05T16:13:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brarob](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@brarob](https://forum.kirupa.com/u/brarob)\
**Post date:** [May 5, 2009, 4:13pm UTC](https://forum.kirupa.com/t/swf-works-fine-wont-play-when-placed-on-html-page-thoughts/287718/1 "2009-05-05T16:13:41Z")

</div>

I’ve got my swf which plays fine when opened in a browser - it’s a container called ‘country’ that’s coded to load the different clips (clip1.swf, clip2.swf, etc.) - but when placing it into an HTML page it won’t load the clips and I’m thinking it’s because of some actionscript error.

I didn’t code this and can’t get my original designer so was looking for any guidance.

Here’s the swf playing fine: [http://dev.traveller.org/india/flash/country.swf](http://dev.traveller.org/india/flash/country.swf)

Here’s the HTML page that doesn’t work: [http://dev.traveller.org/india/](http://dev.traveller.org/india/)

Scripts are all loaded on the server in the /Scripts/ folder

Below is the ActionScript from the country.swf container that loads the clips. Any ideas on what I’m doing wrong to get it to load on the HTML page?

- Bradley

function \_playClip(fileName)  
{  
var clipName = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.indexOf(".")) + “\_mc”;  
if (\_root[clipName] == undefined)  
{  
if (loadingMovie != null)  
{  
mcLoader.unloadClip(loadingMovie);  
delete loadingMovie.onEnterFrame;  
removeMovieClip (loadingMovie);  
trace (loadingMovie);  
loadingMovie = null;  
} // end if  
\_loadClip(fileName);  
} // end if  
this.onEnterFrame = function ()  
{  
var \_loc3 = Math.round(\_root[clipName].getBytesLoaded() / \_root[clipName].getBytesTotal() \* 100);  
\_root[clipName].\_visible = true;  
if (\_loc3 \< 100 || isNaN(\_loc3))  
{  
\_root.currentMovie.gotoAndStop(105);  
}  
else  
{  
trace (clipName + " != " + \_root.currentMovie.\_name);  
if (clipName != \_root.currentMovie.\_name)  
{  
if (\_root[clipName].getDepth() \< \_root.currentMovie.getDepth())  
{  
\_root[clipName].swapDepths(\_root.currentMovie.getDepth());  
} // end if  
\_root.currentMovie.gotoAndPlay(116);  
\_root[clipName].gotoAndPlay(3);  
}  
else  
{  
\_root[clipName].gotoAndPlay(13);  
} // end else if  
\_root.currentMovie = \_root[clipName];  
delete this.onEnterFrame;  
} // end else if  
};  
} // End of the function  
function \_loadClip(fileName)  
{  
var clipName = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.indexOf(".")) + “\_mc”;  
var \_loc3 = Math.round(\_root[clipName].getBytesLoaded() / \_root[clipName].getBytesTotal() \* 100);  
if (\_root[clipName] && \_loc3 == 100)  
{  
return;  
} // end if  
var \_loc4 = \_root.createEmptyMovieClip(clipName, nextDepth);  
++nextDepth;  
mclListener.onLoadStart = function (target\_mc)  
{  
loadingMovie = \_root[clipName];  
if (\_root.currentMovie != null)  
{  
target\_mc.\_visible = false;  
target\_mc.gotoAndPlay(1);  
} // end if  
};  
mclListener.onLoadComplete = function (target\_mc)  
{  
if (\_root.currentMovie != null)  
{  
if (\_root.currentMovie.\_name != target\_mc.\_name)  
{  
target\_mc.stop();  
} // end if  
}  
else  
{  
\_root.currentMovie = target\_mc;  
} // end else if  
loadingMovie = null;  
};  
mcLoader.addListener(mclListener);  
mcLoader.loadClip(fileName, \_root[clipName]);  
} // End of the function  
var home;  
var currentMovie = null;  
var loadingMovie = null;  
var previousMovie = null;  
var mclListener = new Object();  
var mcLoader = new MovieClipLoader();  
if (home == undefined)  
{  
home = “”;  
} // end if  
var nextDepth = 1;  
\_loadClip(home + “clip1.swf”);  
stop ();
