Error in color code .. HTML5 Canvas
Copy link to clipboard
Copied
this.stop();
function color1() {
var myColor: ColorTransform = new ColorTransform;
this.brush.mainbrush.transform.colorTransform = myColor;
this.myColor.color = "#000000";
}
this.brush.addEventListener("click", brushmc.bind(this));
function brushmc() {
this.brush.startDrag(true, new Rectangle(W: 550, H: 400));
}
this.Green.addEventListener("click", Greencolor.bind(this));
function Greencolor() {
this.brush.main.transform.colorTransform = myColor;
this.myColor.color = "#006600";
}
this.Yellow.addEventListener("click", Yellowcolor.bind(this));
function Yellowcolor() {
this.brush.main.transform.colorTransform = myColor;
this.myColor.color = "#FFFF00";
}
this.box.addEventListener("click", boxcolor.bind(this));
function boxcolor() {
if ((this.brush.main.transform.colorTransform = "#FFFF00")) {
this.good.visible = true;
this.good.play();
this.box.transform.colorTransform = "#FFFF00";
} else {
this.good.visible = false;
this.wrong.alpha = 1;
this.box.transform.colorTransform = "#FFFFFF";
}
https://drive.google.com/file/d/1jH-YszEE2yHEG7pAvJY6ZkZH4iImW9sA/view?usp=sharing
Copy link to clipboard
Copied
Hi.
You are mixing AS3 and JavaScript.
Use color filters to change colors or access the shapes inside of your Movie Clips instances if you're not exporting your document as texture.
Color Filter reference:
https://createjs.com/docs/easeljs/classes/ColorFilter.html
Hypothetical way of changing a fill color of a shape inside of a Movie Clip if the document or the object is not being exported as a texture:
var root = this;
root.start = function(e)
{
root.yourMovieClipName.children[0].graphics._fill.style = "#FF0000";
};
stage.on("drawstart", root.start, null, true);
Regards,
JC

