# onEnterFrame from a prototype function

**URL:** <https://forum.kirupa.com/t/onenterframe-from-a-prototype-function/121035>\
**Category:** Uncategorized\
**Created:** [August 30, 2004, 11:53am UTC](https://forum.kirupa.com/t/onenterframe-from-a-prototype-function/121035 "2004-08-30T11:53:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mediatot](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mediatot](https://forum.kirupa.com/u/mediatot)\
**Post date:** [August 30, 2004, 11:53am UTC](https://forum.kirupa.com/t/onenterframe-from-a-prototype-function/121035/1 "2004-08-30T11:53:05Z")

</div>

The function is called on release of a movieclip. I’m making a drag a  
drop navigation and there are two content windows … “h1” and “h3”.

```
I don't think there's anything(much) wrong with my code itself, I'm
just having trouble with calling anything within h_ins.onEnterFrame.
Is there a fundamental issue that I'm not aware of? Below are all the
details if you're interested.

```

```php
if(this._droptarget.substr(0,3) == "/h1" ||
   this._droptarget.substr(0,3) == "/h3") {
    	   var n;
    	   if(this._droptarget.substr(0,3) == "/h1") {
    			   n = 1;
    	   }
    	   if(this._droptarget.substr(0,3) == "/h3") {
    			   n = 3;
    	   }
    	   loadCon(n,"sub11.swf");
   }

```

Now here’s the function called…  
I have previous javascript knowledge just so you know where I’m coming  
from…

```php
MovieClip.prototype.loadCon = function(n, file) {
    	   hcon = eval("_root.h"+ n +".h"+ n +"con");
    	   hcon._alpha = 0;
    	   hcon.loadMovie(file);
    	   this.createEmptyMovieClip("h_ins",92);
    	   h_ins.onEnterFrame = function() {
    			   hcon = eval("_root.h"+ n +".h"+ n +"con");
    			   hmask = eval("_root.h"+ n +".h"+ n +"conMask");
    			   hlbar = eval("_root.h"+ n +".h"+ n +"loadBar");
    			   hltext = eval("_root.h"+ n +".h"+ n +"loadText");
   
    			   th = hcon.getBytesTotal();
    			   lh = hcon.getBytesLoaded();
    			   percenth = Math.round((lh/th)*100);
 			 //hlbar is a standard solid shape for the preloader
    			   hlbar._visible = 1;
    			   hlbar._xscale = percenth;
 			 //hltext is a movieclip with a dynamic text field within
    			   hltext.loadText.text = percenth+" %";
    			   if (hcon._width > 0 && th == lh) {
 					 hlbar._xscale = 0;
 					 hltext.loadText.text = "";
 					 hcon.setMask(hmask);
 					 hcon.fadeIn(5,100);
 					 delete h_ins.onEnterFrame;
    			   }
    	   }
   }

```

The problem is, it’s not even calling h\_ins.onEnterFrame once … why  
is that?  
The movie loads fine if I set the \_alpha to 100, but I need the  
preloader to check wheather it’s fully loaded and wheather or not I  
can apply the mask to it.

Thanks for your time, and hopefully thanks for your help.
