Highlighted

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

Community Beginner ,
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!

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

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.

TOPICS
Code, Other

Views

195

Likes

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

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

Community Beginner ,
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!

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

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.

TOPICS
Code, Other

Views

196

Likes

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
Dec 17, 2019 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Dec 17, 2019 0
Community Beginner ,
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?

Likes

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
Reply
Loading...
Dec 22, 2019 0
ClayUUID LATEST
Adobe Community Professional ,
Dec 23, 2019

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Dec 23, 2019 0