Copy link to clipboard
Copied
Hello Dear Community
I want to make a bulb light on in a canvas project, by click and hold on the button, and when I release the button is turning off, can you help me with it.
I need the code
Please help
Copy link to clipboard
Copied
var _this = this;
_this.light_on.on('click', function () {
_this.light_off.visible = true;
_this.light_on.visible =false;
});
_this.light_off.on('click', function () {
_this.light_on.visible = true;
_this.light_off.visible=false;
});
Copy link to clipboard
Copied
Thanks for the reply , but I don't get you this my fla on the attached file
https://lbhmus.com/fla/bulb.fla
Copy link to clipboard
Copied
I got it thanks anyway
Copy link to clipboard
Copied
var _this = this;
_this.button.on('click', function(){
_this.bulb.gotoAndStop('on');
});
Copy link to clipboard
Copied
thank you, if I want to add conditions, click on two buttons ?
Copy link to clipboard
Copied
_this.button.on('click', function(){
if (..............................)) {
/////code
} else if (......................................)) {
/////code
} else if (........................)) {
/////code
} else {
////code
}
Copy link to clipboard
Copied
thanks you very much