# I need to use super() in a handler function but AS3 won't let me!

**URL:** <https://forum.kirupa.com/t/i-need-to-use-super-in-a-handler-function-but-as3-wont-let-me/326603>\
**Category:** flash\
**Created:** [December 28, 2011, 12:25pm UTC](https://forum.kirupa.com/t/i-need-to-use-super-in-a-handler-function-but-as3-wont-let-me/326603 "2011-12-28T12:25:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![caccola](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@caccola](https://forum.kirupa.com/u/caccola)\
**Post date:** [December 28, 2011, 12:25pm UTC](https://forum.kirupa.com/t/i-need-to-use-super-in-a-handler-function-but-as3-wont-let-me/326603/1 "2011-12-28T12:25:23Z")

</div>

Hi all, sorry for my english (i’m from Italy)

I’m trying to make a CustomLoader class that extends another class.  
In the contructor of my CustomLoader, i need to call super(myLoader:Loader) where myLoader is a Loader  
object. Problem is I need to listen to the complete event of the loader before passing it or i’ll get an “Error #1009: Cannot access a property or method of a null object reference”. but if i put super() in a handler function i get an “Error 1007 : A super statement can be used only inside class instance constructors.”

Do you have any idea how to solve this problem?

Here’s part of my code:

```auto
public class CustomLoader extends ParentClass
{
       ...

     public function CustomLoader():void
    {
         var url:URLRequest = new URLRequest("somemovieclip.swf");
         var myLoader = new Loader();
         myLoader.load(url);
         super(myLoader); // <----------- this gives error #1009
          myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function ()
         {
              super(myLoader); <-------- this gives error #1007
         }
          );
     }
}

```

Any help will be highly appreciated :flower:
