Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Flashlight effect

Community Beginner ,
Aug 24, 2010 Aug 24, 2010

Okay. Basically, I need a flashlight effect on my game, kind of like wherever your mouse goes, it looks like you are holding a flashlight there and it can reveal hidden things.

I used a tutorial on how to do it, and it worked O.K... Basically my primary objective was there would be text and it would be masked until the cursor passed over it and you could see. It didn't work at first but when I changed it from input text to static text it worked... sort of.

It only worked for the first thing I put there. If I put 7 different text boxes, it would only reveal the first.

Here is the video: http://www.youtube.com/watch?v=6UCbQojCkwE

If you don't want to watch the video, it basically says to create 3 layers, the top layer being an action layer, the second layer being where you mask stuff, the 3rd layer being where the flashlight is put.

Action layer = Put code to make flashlight follow cursor

Mask layer = Put stuff that you don't want visible until flashlight is over it

Flashlight layer = Put the flashlight in this layer

And you right click the 2nd layer, and check "Mask" and it should work

But I still have the problem that it only works for the first text box...

If any of you guys could help me figure out why it only works that way, or supply me with an alternative way to replicate a flashlight effect, please do

Thanks

-Spaghetee

TOPICS
ActionScript
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 24, 2010 Aug 24, 2010

embed your font.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2010 Aug 24, 2010

I did embed the font, it only works for the first text box that I put

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 24, 2010 Aug 24, 2010

and you're masking a parent of the 7 textfields?  or you're masking something else?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2010 Aug 24, 2010

I'm not familiar with the term "parent", what I did was I put all the 7 textboxes in one layer and masked that layer

The flashlight layer is below the layer with the hidden textboxes

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 24, 2010 Aug 24, 2010

If the flashlight layer is below the text layer, how can it ever be above the text to mask it?  THe flashlight layer should be the one assigned as a mask, and it should be above the text layer when you assign it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2010 Aug 24, 2010

Now it works but it doesn't have the cool flashlight effect (the illusion that your cursor is really a flashlight), and I would like for it to be like a flashlight in the sense that if you are directly over it the text is brighter than if you were adjacent to it...

Out of the frying pan and into the fryer

EDIT: Would there be a way to make a transparrent unmasker on the flashlight layer and another layer below the text layer to have the flashlight effect and the unmasking effect?

Testing it, but I don't know how to make a transparrent bubble

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 24, 2010 Aug 24, 2010

use this:

www.kglad.com/Files/forums/mask.fla

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 25, 2010 Aug 25, 2010

I guess my question has been answered, kglad- I found your answer helpful but it produced the same results (essentially) as before- The cool flashlight effect is something I'm willing to sacrifice for the revealing of more than one textbox

Thanks guys

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2010 Aug 25, 2010

all the textfields are revealed by the mask in the linked file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 25, 2010 Aug 25, 2010

From what's described, I think the desired effect that might be missing is the making use of a radial gradient/cacheAsBitmap type stuff such that a fade is realized as you near the outer area of the mask.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2010 Aug 25, 2010

oh.

if you want to use an alpha fade in a mask, you must mask a movieclip (ie, attach your textfields to a movieclip) and enable the cacheAsBitmap property of both the mask and masked movieclips.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 25, 2010 Aug 25, 2010

Yeah, I do wish to use the "radial gradient/cacheAsBitmap type stuff such that a fade is realized as you near the outer area of the mask"

A few things I don't understand here though

1. How do I mask a movieclip?

2. How do I mask the unmasker? (The gradient circle)

3. How do I enable the cacheAsBitmap?

Thanks

-Spaghetee

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2010 Aug 25, 2010
LATEST

same link shows one way to use a alpha-gradient mask

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines