# Call function in imported class from main class

**URL:** <https://forum.kirupa.com/t/call-function-in-imported-class-from-main-class/319313>\
**Category:** Uncategorized\
**Created:** [February 16, 2011, 1:58am UTC](https://forum.kirupa.com/t/call-function-in-imported-class-from-main-class/319313 "2011-02-16T01:58:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristessa](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@tristessa](https://forum.kirupa.com/u/tristessa)\
**Post date:** [February 16, 2011, 1:58am UTC](https://forum.kirupa.com/t/call-function-in-imported-class-from-main-class/319313/1 "2011-02-16T01:58:42Z")

</div>

Hello, its probably been asked (X) times.  
However I cannot spot my mistake here.

I’ve read : [http://greenethumb.com/article/23/understanding-root-and-the-document-class-in-as3](http://greenethumb.com/article/23/understanding-root-and-the-document-class-in-as3)

Which helps me perfectly to call a function from the “imported” class inside the documentclass.

But I can’t seem to manage to trigger a function inside my imported class:  
This class is functionality for a button:  
aka i want to show some text inside that specific button:

main.as:

```auto
public function ldr_onComplete( event:Event ):void
		{
			var variables:URLVariables = new URLVariables(event.target.data);
			ldr.removeEventListener(Event.COMPLETE, ldr_onComplete);
var SAVE:save_button = new save_button();
			SAVE.COMPLETED();
		}

```

save\_button.as

```auto
public function COMPLETED():void 
		{
			trace ("save DONE");
			saveBool = true;
			
		}

```

This traces the following error:

```auto

TypeError: Error #1009: Kan geen eigenschap of methode benaderen via een verwijzing naar een object dat null is.
	at classes.buttons::save_button()
	at main2/ldr_onComplete()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()

```

So going back to that greenethumb blog post.  
I am doing the exact same thing (i think) as he mentioned with:  
child.traceRoot(); inside his main class…

any help is more then welcome. it baffles me.  
cheers
