# Creating a torch light/spot light effect?

**URL:** <https://forum.kirupa.com/t/creating-a-torch-light-spot-light-effect/328784>\
**Category:** flash\
**Created:** [June 16, 2012, 4:29pm UTC](https://forum.kirupa.com/t/creating-a-torch-light-spot-light-effect/328784 "2012-06-16T16:29:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Profitemole](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@Profitemole](https://forum.kirupa.com/u/Profitemole)\
**Post date:** [June 16, 2012, 4:29pm UTC](https://forum.kirupa.com/t/creating-a-torch-light-spot-light-effect/328784/1 "2012-06-16T16:29:58Z")

</div>

I have two versions of the same movie clip background image, one at normal brightness and the other with a darker brightness (by duplicating the movie clip and placing it behind the brighter image).  
I’ve created a small circular mask to use as the torch light  
The code I’m using is:

Mouse.hide();

pic\_mc.cacheAsBitmap = true  
mask\_mc.cacheAsBitmap = true  
pic\_mc.mask = mask\_mc

stage.addEventListener(Event.ENTER\_FRAME,custom);  
function custom(event:Event):void {  
mask\_mc.x = mouseX  
mask\_mc.y = mouseY  
}

The problem is, that when I’ve tried to duplicate this template I’m using in my own project, I get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at ZombieGame15\_fla::MainTimeline/frame355()  
at flash.display::MovieClip/gotoAndStop()  
at ZombieGame15\_fla::MainTimeline/droptl()

Would someone be able to talk me through created this effect from scratch?  
I’m wondering if I maybe missed a step. I copied the mask across to my project, renamed my background image movie clip and copied the code.
