# Problems targeting preloader

**URL:** <https://forum.kirupa.com/t/problems-targeting-preloader/189345>\
**Category:** flash\
**Created:** [June 1, 2006, 8:41pm UTC](https://forum.kirupa.com/t/problems-targeting-preloader/189345 "2006-06-01T20:41:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dopewon](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dopewon](https://forum.kirupa.com/u/dopewon)\
**Post date:** [June 1, 2006, 8:41pm UTC](https://forum.kirupa.com/t/problems-targeting-preloader/189345/1 "2006-06-01T20:41:19Z")

</div>

I’m building a site with a “preloader” swf that loads the “main” swf.  
From there I load in the “content” swfs into a movie clip on the “main” swf’s timeline. Inside one of the “content” swfs I need to load in “sub-content” swfs and preload them. I have the preloader script on the \_root timeline of the “content” swf and it works perfect when I test the movie by itself. But when I test the movie through the original preloader/main/content path nothing loads.

Here is the preloader script:

=================================================

this.loaderElements.\_visible = false;  
// Define custom function as seen below  
function preload(MyCache) {  
this.loaderElements.\_visible = true;  
// if the Cache is Loaded do the following  
if (!MyCache.doneLoading) {  
if (MyCache.\_framesloaded\>0 && MyCache.\_framesloaded == MyCache.\_totalframes) {  
[//MyCache.doneLoading](https://MyCache.doneLoading) = true;  
this.loaderElements.\_visible = false;  
}  
//declares the local variable ‘percentLoaded’ is equal to MyCache Loaded Bytes Divided by MyCache Total Bytes  
var percentLoaded = Math.round((MyCache.getBytesLoaded()/MyCache.getBytesTotal())_100)+" %";  
// set up the Outputs  
this.loaderElements.OutputLoaded = percentLoaded;  
this.loaderElements.OutputTotal = MyCache.getBytesTotal();  
 [//this.loaderElements.fileName](https://this.loaderElements.fileName) = myNewSwf;  
// var declares a local variable ‘Slash’  
var Slash = MyCache.\_url.lastIndexOf("/");  
// make the Output File equal my Cache URL  
this.loaderElements.OutputFile = MyCache.\_url.substring(Slash+1, MyCache.\_url.length);  
// make the Bar variable width equal the BarBorders width multiplied by the Percent Loaded   
this.loaderElements.Bar.\_width = this.loaderElements.BarBorder.\_width_percentLoaded ;  
}  
}

================================================

If anyone can target the elements differently it would be greatly appreciated.
