Copy link to clipboard
Copied
Hi, newbie beginners question: I'm trying to target a movieclip on the timeline in order to change the colour of an element inside the movieclip.
The movieclip on the timeline is called 'meCircle', and inside meCircle there is another movieclip called 'meCircleRed'
I thought I'd be able to use this to change the colour of the movieclip inside;
this.meCircle.meCircleRed.style.backgroundColor = #000;
But does not work... is it correct that meCircleRed should be a movieclip, or perhaps a button?
Finding it difficult to find any examples online to learn from! any pointers to good online guides much appreciated...
Since you specify JavaScript I assume you're working in a Canvas document.
No, you cannot slap CSS styles on movieclips. Canvas mode Does Not Work That Way. To recolor objects in Canvas documents you use the ColorFilter class.
However, all Canvas filter effects except alpha are VERY SLOW, because they're implemented in JavaScript. The bigger the object, the more likely your timeline will noticeably freeze up while the filter is being applied. This may or may not be acceptable depending on what you
...Copy link to clipboard
Copied
Since you specify JavaScript I assume you're working in a Canvas document.
No, you cannot slap CSS styles on movieclips. Canvas mode Does Not Work That Way. To recolor objects in Canvas documents you use the ColorFilter class.
However, all Canvas filter effects except alpha are VERY SLOW, because they're implemented in JavaScript. The bigger the object, the more likely your timeline will noticeably freeze up while the filter is being applied. This may or may not be acceptable depending on what you're using it for.
There are alternative approaches too, like storing versions of the graphic pre-drawn in the colors you'll need, or tinting the object with an alpha overlay, or redrawing the object from scratch in code.
Copy link to clipboard
Copied
ah, thought it seemed a bit too easy... thanks, will read through a lot more of your link!
Copy link to clipboard
Copied
while I'm here, would you mind just pointing me to the code for tinting an object with an alpha overlay – I think that might be the solution I need...
thanks again
Copy link to clipboard
Copied
There is no code. You just put a transparent colored thing over the thing you want to tint. You know, like in the real world.
Copy link to clipboard
Copied
ah, okay, I see! thanks!