# Call function in parent class from child class

**URL:** <https://forum.kirupa.com/t/call-function-in-parent-class-from-child-class/277307>\
**Category:** Uncategorized\
**Created:** [December 10, 2008, 3:36pm UTC](https://forum.kirupa.com/t/call-function-in-parent-class-from-child-class/277307 "2008-12-10T15:36:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cerbellum](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@cerbellum](https://forum.kirupa.com/u/cerbellum)\
**Post date:** [December 10, 2008, 3:36pm UTC](https://forum.kirupa.com/t/call-function-in-parent-class-from-child-class/277307/1 "2008-12-10T15:36:08Z")

</div>

Right, so I have a main Document class called Bundl where I’m loading all my other classes (navigation, portfolio, …). What I’m trying to accomplish is to call a function inside my main Bundl class from a click from the navigation class.

The situation in code:  
The Bundl Class (located in the root folder)

```auto
package {
	import be.bundl.Navigation;

	public class Bundl extends Sprite {
		//vars called here

		public function Bundl() {
			nav=new Navigation("xml/navigation.xml");
			addChild(nav);
		}
		//some more irrelevant functions here

		//the function I need to call from the Navigation Class
		public function portfolioXML(newXML:String):void {
			portfolio=new Portfolio(newXML);
			contentContainer.addChild(portfolio);
		}
	}
}

```

The code from Navigation class (located in /be/bundl)

```auto
//inside the btnClick function
var test:Bundl = new Bundl();
test.portfolioXML(_someVar)

```

Which results in an :  
Error: Error #2136: The SWF file file:///Macintosh%20HD/Users/cerbellum/Projects/Bundl/site/FINAL/FULL.swf contains invalid data. at be.bundl::Navigation/btnClick()

I’m guessing this is due to the fact that I’m calling the parent class in a child or something like that, but how do I get this done otherwise? I must totally be overlooking something here.

Thanks in advance,  
Kevin
