Skip to main content
HSS Sursee
Known Participant
Jul 14, 2023 9:10 AM UTC
Question

Movieclip change Color

I made a rectangle to a movieclip and want to change the color on a mouseover. I can change the color of the textfield but with my background rectangle it's not working (not working code is bold and italic).

 

This is my code for now:

var _this = this;
stage.enableMouseOver(3);
_this.Start_Level_1.on('mouseover', function(){

_this.Start_Level_1.Start_Level_1_Grafik.color = 'blue';

_this.Start_Level_1.Start_Level_1_Text.color = 'black';
});

 

Thanks for your help.

    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    kglad
    Community Expert
    Community Expert
    Jul 14, 2023 3:08 PM UTC

    you should really convert the rectangle to an symobl (eg, movieclip), assign it an instance name and then assign its children[0].graphics._fill.style.

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    Jul 14, 2023 12:49 PM UTC

    Hi.

     

    If your MovieClip instance only contains a text field and a raw vector shape and if you're are using Animate's default publish settings, then you could use the _fill property like this:

    var _this = this;
    
    stage.enableMouseOver(3);
    
    _this.Start_Level_1.on('mouseover', function(e)
    {
    	e.currentTarget.yourTextField.color = 'blue';
    	e.currentTarget.children[0].graphics._fill.style = 'black';
    });

     

    I hope this helps.

     

    Regards,

    JC

     

    Translate