# Dynamic event handlers onLoaded jpgs?

**URL:** <https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440>\
**Category:** Uncategorized\
**Created:** [February 26, 2003, 6:09am UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440 "2003-02-26T06:09:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kupreg](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kupreg/32/171_2.png) [@kupreg](https://forum.kirupa.com/u/kupreg)\
**Post date:** [February 26, 2003, 6:09am UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/1 "2003-02-26T06:09:58Z")

</div>

ok, so i’ve been trying to use dynamic event handlers for everything lately ever since i discovered them. but i’ve run into a problem. when i’m loading jpgs into a movie clip it erases the handlers that i put on them example:

movieClip.prototype.traceName=function(){  
trace(“this.\_name”);  
}  
this.createEmptyMovieClip(“pan\_b”,1);  
this.pan\_b.onEnterframe=traceName;  
//this.pan\_b.loadMovie(“pann.jpg”);

then when i load in the jpg into that clip it stops tracing. i can’t even try and put the handler back on to the clip. Now i would be fine with this and try to find a different way if it weren’t for the fact that if you don’t use a dynamic handler and put it onto a created clip it will work. which makes me think there is a way its just probably some tricky syntax or something. i’ve been working on it for a while so i’m sure enough that its not a typo.  
what i’m trying to do is check when it gets done loading into the clip so i can have it appear or whatever. onData…  
any help would be much appreciated,  
thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 8:20am UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/2 "2003-02-26T08:20:50Z")

</div>

If those are an exact copy of the code you put into script… I’ll fix soem mistakes and give you something cool to check out 🙂

```php

MovieClip.prototype.traceName = function()
{
   trace("this._name");
}
_root.onLoad = function()
{
   this.createEmptyMovieClip("pan_b", 1);
   loadMovie("pann.jpg", _root.pan_b);
}
pan_b.onEnterFrame = function()
{
   this.traceName();
}

```

Tell me if this is about the effect you wanted… You can also make it where you can tets if the jpg has fully loaded or not yet… And then when it is fully loaded do all the tracenames… But that should return what you want… Should.

🙂 I fixed some uppercase problems too you might have had 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 8:30am UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/3 "2003-02-26T08:30:17Z")

</div>

this line looks weird … :crazy:

```auto
MovieClip.prototype.traceName = function() {
trace( **"this._name"** );
}

```

```auto
MovieClip.prototype.traceName = function() {
trace( **this._name** );
}

```

it looks better now 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 9:09am UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/4 "2003-02-26T09:09:29Z")

</div>

_lmao_… Good call again…

I missed that one… 🙂

One Hint for ya… Check your spelling and your uppercase and lowercase placement with the ones flash has… it’ll save you time in the long run…

Thanks for pointing out my “quote” error there kax 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 11:00am UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/5 "2003-02-26T11:00:47Z")

</div>

no problem playa 🙂

that’s why we are here anyway 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 3:43pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/6 "2003-02-26T15:43:29Z")

</div>

That won’t work either (well it shouldn’t), Playamarz, because loading inside a clip will erase anything in that clip, including event handlers, and you can’t assign even handlers before the jpg is fully loaded.

The trick is to preload the jpg, wait for it to be fully loaded, and then assign the handler.

pom :tie:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 6:09pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/7 "2003-02-26T18:09:21Z")

</div>

No sheit?

Humph… Well that’s stupid… _lmao_…

Could you possibly have a movie clip inside of pan\_b that laods up the variable? Or would that take the movieclip it’s in and screw it up…?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 6:12pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/8 "2003-02-26T18:12:35Z")

</div>

Yep, that’s actually a very good way to solve the “problem” (not really a problem, as it’s actually quite logical).

pom :phil:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 6:33pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/9 "2003-02-26T18:33:17Z")

</div>

```php

MovieClip.prototype.traceName = function()
{
   trace(this._name);
}
_root.onLoad = function()
{
   loadMovie("pann.jpg", _root.pan_b.loadArea);
}
pan_b.onEnterFrame = function()
{
   this.traceName();
}

```

That look a little better…? I’d suggest doing it this way… And having the actual blank mvoieclips made through the use of the FLash MX drawing interface… It’ll be cleaner that way… Juts make a movieclip names pan\_b then make a movieclip inside of tht movieclip names loadArea.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 7:10pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-onloaded-jpgs/14440/10 "2003-02-26T19:10:33Z")

</div>

ok sure that all makes sense, but i don’t really want it to trace the name on the enter frame i just want it to trace once that loadArea gets loaded. i don’t want a whole bunch of enterframes running at the same time.
