# Calling a function with a button

**URL:** <https://forum.kirupa.com/t/calling-a-function-with-a-button/253907>\
**Category:** flash\
**Created:** [March 6, 2008, 11:06am UTC](https://forum.kirupa.com/t/calling-a-function-with-a-button/253907 "2008-03-06T11:06:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alber\_Kidd](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alber\_Kidd](https://forum.kirupa.com/u/Alber_Kidd)\
**Post date:** [March 6, 2008, 11:06am UTC](https://forum.kirupa.com/t/calling-a-function-with-a-button/253907/1 "2008-03-06T11:06:59Z")

</div>

Join Date: Sep 2007  
Posts: 2

```
							 		 	 	 	 	 	 		 			 			 				[IMG]http://www.actionscript.org/forums/images/icons/icon1.gif[/IMG] **Calling a function within a class** 			
		 			 		 		 		 		Hi I have created a basic class that says hello when the runs but I want to know how to call the sayGoodBye() function with a mouse click on a button or movieclip. The button/movie does not belong to this class

```

Thanks,

package {  
import flash.display._;  
import flash.events._;  
import fl.transitions.\*;  
import flash.display.MovieClip;

```
public class Greetings extends MovieClip

{
	

	
public function Greetings()
	{
		trace('hello');
		
	
	}
	
	
	public function sayGoodBye()
	{
		trace('see ya');
	}
```
