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

I can't target the mask in javascript. I need it to follow the mouse

Community Beginner ,
Dec 17, 2019 Dec 17, 2019

Copy link to clipboard

Copied

Hi. First post, thanks for reading 

 

Here is what I have to target the movie clip on the mask layer:

 

 

exportRoot.labelXMask.x = props.graph.maskX.x

 

 

Now this works fine when the layer is not a mask but becomes un-targetable once the layer is made a mask. I've done a bit of reading and from what I've gathered once I've published that movie clip on the mask it loses its instance name.

 

Other people seem to have cracked it by targeting 'mask', which I have to admit is not making much sense to me. I've tried the following:

 

 

exportRoot.mask.x = props.graph.maskX.x
exportRoot.labelXMask.mask.x = props.graph.maskX.x
mask.x = props.graph.maskX.x
mask_1.x = props.graph.maskX.x

 

 

but no luck 😞 Can anyone shed some light, please? 

Save me Obi-Wan!

TOPICS
Code , Other

Views

348

Translate

Translate

Report

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

correct answers 1 Correct answer

LEGEND , Dec 17, 2019 Dec 17, 2019

While it might be possible to do what you want by rummaging around in the guts of the generated data structures, you're far better off doing this properly with a programmatic mask.

this.themask.visible = false;
this.maskee.mask = this.themask.shape;
this.themask.shape.x = 200;

Where "maskee" is the movieclip to be masked, and "themask" is a movieclip containing a single, contiguous vector shape and nothing else. Origin for the masked region is 0, 0 of the masked clip's parent.

Votes

Translate

Translate
LEGEND ,
Dec 17, 2019 Dec 17, 2019

Copy link to clipboard

Copied

While it might be possible to do what you want by rummaging around in the guts of the generated data structures, you're far better off doing this properly with a programmatic mask.

this.themask.visible = false;
this.maskee.mask = this.themask.shape;
this.themask.shape.x = 200;

Where "maskee" is the movieclip to be masked, and "themask" is a movieclip containing a single, contiguous vector shape and nothing else. Origin for the masked region is 0, 0 of the masked clip's parent.

Votes

Translate

Translate

Report

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 ,
Dec 22, 2019 Dec 22, 2019

Copy link to clipboard

Copied

Hi Clay - I have a question regarding my specific scenario if you don't mind. 

 

I have two masks on the stage - one has it's x coordinates set by the mouse and the other the y coordinates. I'm using these masks to only reveal bold text when the correct region is being highlighted. 

 

If I'm reading you're answer correctly:

It's targeting a shape I've generated in animate? 

 

 

this.themask.visible = false;
this.maskee.mask = this.themask.shape;
this.themask.shape.x = 200;

 

 

in my case would be:

 

exportRoot.maskX.visible = false;
exportRoot.labelX.mask = exportRoot.maskX.shape;
exportRoot.maskX.shape.x = props.mouse.x

 

 

Does that seem right to you?

Votes

Translate

Translate

Report

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 ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

LATEST

Probably? Why don't you try it and see if it works.

Votes

Translate

Translate

Report

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