Highlighted

Alter movie clip colour with javascript

Explorer ,
May 14, 2020

Copy link to clipboard

Copied

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

TOPICS
Code

Views

123

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

Alter movie clip colour with javascript

Explorer ,
May 14, 2020

Copy link to clipboard

Copied

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

TOPICS
Code

Views

124

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
May 14, 2020 0

Have something to add?

Join the conversation