# Using an event listeners function at will - event dispatching?

**URL:** <https://forum.kirupa.com/t/using-an-event-listeners-function-at-will-event-dispatching/241968>\
**Category:** flash\
**Created:** [October 20, 2007, 3:38am UTC](https://forum.kirupa.com/t/using-an-event-listeners-function-at-will-event-dispatching/241968 "2007-10-20T03:38:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![waffe](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@waffe](https://forum.kirupa.com/u/waffe)\
**Post date:** [October 20, 2007, 3:38am UTC](https://forum.kirupa.com/t/using-an-event-listeners-function-at-will-event-dispatching/241968/1 "2007-10-20T03:38:33Z")

</div>

Hi,

I have a event listener that turns a camera on and off according to how much motion there is:

camera1 = Camera.getCamera(""+Number(aCameraComboBoxes[selComboBoxNum].selectedIndex-1));  
aCameras[selComboBoxNum].addEventListener(ActivityEvent.ACTIVITY, activityHandler, false, 0, true);

private function activityHandler(event:ActivityEvent):void {  
if(event.activating){  
//camera is turning on  
}else if (!event.activating){  
//camera is turning off  
}  
}

All of this works but I need a way to rerun the addlistener’s function without the camera actual turning on or off. Is there a way for me to use this function, and send it the variable it is looking for?

Thanks
