Skip to main content
Inspiring
May 14, 2020
Question

Alter movie clip colour with javascript

  • May 14, 2020
  • 0 replies
  • 265 views

Hi

 

I have a movieclip in the library (NOT on the stage) which has linkage myBall. I am adding a balls to the time line like this:

var newBall = new lib.myBall();
newBall.x=30;
newBall.y=100;
ballField.addChild(newBall);
	

ballField is a mc on the timeline

 

This is all working fine.

I want to change the colour of the ball. I have tried several things: including this before the above code

lib.myBall.shape.graphics._fill.style = "#FF00FF"; 

which gives lib.myBall.shape is undefined

... and this before the addChild command

newBall.shape.graphics._fill.style = "#FF00FF"; 

which gives newBall.shape is undefined

This topic has been closed for replies.