# \[Flash 8\] OOP & how to do this?

**URL:** <https://forum.kirupa.com/t/flash-8-oop-how-to-do-this/181816>\
**Category:** flash\
**Created:** [March 13, 2006, 1:02pm UTC](https://forum.kirupa.com/t/flash-8-oop-how-to-do-this/181816 "2006-03-13T13:02:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rasper](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@Rasper](https://forum.kirupa.com/u/Rasper)\
**Post date:** [March 13, 2006, 1:02pm UTC](https://forum.kirupa.com/t/flash-8-oop-how-to-do-this/181816/1 "2006-03-13T13:02:43Z")

</div>

So I’m trying to make an imageviewer in flash, using the concept of OOP. Inside one of my classes I’m using an MovieClipLoader to load an image. When the loading starts, I want to use my classvariable “preload” to show a preloader (which is another class of mine). However, when I try to use the this-keyword to call my preload-variable inside the onLoadStart, it will refer to the listener, not to the class (in this case TestClass).

It’s possible to use a \_global to define my preload variable, but I try to avoid using \_globals. Because I also use the onLoadProgress and the onLoadInit listeners it would mean that everything in my class would have to be a \_global to be able to use them. Is there another way of referring to my preload variable?

Here’s a sample code of what I mean:

```auto
class TestClass {
 var mc_holder:MovieClip;
 var testvariable:Number;
 var preload:Preloader;
 var loadImageListener:Object;
 var movieClipLoader:MovieClipLoader;
 
 function TestClass(mc_holder:MovieClip){
  this.mc_holder = mc_holder
  this.preload = new Preloader();
  this.loadImageListener = new Object();
  this.movieClipLoader = new MovieClipLoader(); 
  this.movieClipLoader.addListener(loadImageListener);
  loadFunction();
 }
 
 function loadFunction():Void{
  movieClipLoader.loadClip("image.jpg", this.mc_holder);
  loadImageListener.onLoadStart = function():Void{
   this.preload.startloading(); //--> UNDEFINED
  };
 }
}

```

I really hope someone can help me out with this one.  
Thanks in advance!
