Skip to main content
Inspiring
December 17, 2015
Answered

Flashlight

  • December 17, 2015
  • 1 reply
  • 886 views

How can I be assigning an effect, say, "flashlight" in a scenario? Illuminate the site according to mouse route on the scene, in this case, touch screen ...

Could anyone help me?


Below I leave an example:

This topic has been closed for replies.
Correct answer dmennenoh

Follows exactly the steps you showed me up, but when I got to the part to add to the mask layer 2, the field objects all gone, like the image below.

Would you help me?


1.

2.


You need to fill that shape, not just use an outline.

1 reply

Inspiring
December 17, 2015

A mask is the answer. Super easy... just make an oval shape over your image layer - assign as mask and then move that via mouse.

vvvverTAuthor
Inspiring
December 18, 2015

Please, if possible, and if not too much disturbance, could explain a 'detailed' way?

Grateful.

Inspiring
December 18, 2015

Google will help lots.. but here's a simple example.

Make a new project.

Add your shark image.

Make a new layer and then draw an oval shape in it. Select the oval and turn it into a movie clip - centered reg point.

Give it an instance name of 'light'

Right click it's layer name (Layer 2) in the timeline and select Mask

Now you should see only that part of the image under the mask

Make a new layer (Layer 3) and then click the Actions tab - enter this code, and then run the movie:

addEventListener(Event.ENTER_FRAME, update);

function update(e:Event):void

{

  light.x = mouseX;

  light.y = mouseY;

}