# Class Question

**URL:** <https://forum.kirupa.com/t/class-question/119955>\
**Category:** Uncategorized\
**Created:** [August 19, 2004, 1:49pm UTC](https://forum.kirupa.com/t/class-question/119955 "2004-08-19T13:49:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iloveitaly](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@iloveitaly](https://forum.kirupa.com/u/iloveitaly)\
**Post date:** [August 19, 2004, 1:49pm UTC](https://forum.kirupa.com/t/class-question/119955/1 "2004-08-19T13:49:50Z")

</div>

Hey all,  
I am having trouble with classes and loading external files, specifically .jpgs.  
I have a simple class, that looks like this,

```auto

dynamic class test extends MovieClip {
var nn;
function test() {
nn = this.num
trace(nn)
}
function onEnterFrame () {
trace(nn)
}
}

```

I have it attached to the stage, it traces nn repetitively until i load the jpg, when i load the jpg into it, it loses all of it class properties it seems…  
it stops the onEnterFrame and the nn is no longer there.  
Take a look at the fla to see what i mean…

NOTE: mx2004 only…

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 19, 2004, 2:31pm UTC](https://forum.kirupa.com/t/class-question/119955/2 "2004-08-19T14:31:54Z")

</div>

its not a class issue, its a loadMovie issue.

Whenever you use loadMovie on a movieclip it will lose all properties and methods assigned to it and is a “cleared” movieclip.

Instead, create an extra movieclip within your class movieclip symbol and load images into that

---

<div class="post-metadata">

**Author:** ![iloveitaly](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@iloveitaly](https://forum.kirupa.com/u/iloveitaly)\
**Post date:** [August 19, 2004, 11:15pm UTC](https://forum.kirupa.com/t/class-question/119955/3 "2004-08-19T23:15:45Z")

</div>

ohhh, i get it, thx!  
I have another question also though…  
It again has to do with classes (man am i having trouble with them…)  
I made a class, and attched to the stage. ok cool everything works as it should. The problem is the buttons inside the MC that i attachted wont work at all. I narrowed it down to be the function onRollOver(){} that i have in my attached movie clip’s class. If i remove that all the buttons work great…  
Any ideas on how to fix this?  
PS, i am thinking about getting colin mooks book actionscript 2, have any of you used it/read it? if so what do you think?  
Does it cover classes in great detail? Becuase thats the thing i am really having trouble with…

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 19, 2004, 11:30pm UTC](https://forum.kirupa.com/t/class-question/119955/4 "2004-08-19T23:30:34Z")

</div>

this is another common issue, just like the loadMovie. You cannot have button events for instances within movieclips that have button events them selves. The movieclip’s events will always over-ride the events of instances within it. You’ll just to have to not have an onRollOver for your class and instead use it in somethign else within your movieclip - another movieclip or more buttons, just like the buttons you have in there now.

---

<div class="post-metadata">

**Author:** ![iloveitaly](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@iloveitaly](https://forum.kirupa.com/u/iloveitaly)\
**Post date:** [August 20, 2004, 1:27am UTC](https://forum.kirupa.com/t/class-question/119955/5 "2004-08-20T01:27:24Z")

</div>

oh, ok, thanks!
