Copy link to clipboard
Copied
===========================
<<Action Script 1.0>>
on (release, keyPress "<Space>") {
gotoAndStop(10);
tellTarget ("_root") {
play();
}
}
===========================
In Animate 2020, What can I use for ((keyPress "<Space>")) ?
===========================
var _this = this;
_this.stop();
var _this = this;
_this.PlayMovie.on('click', function(){
_this.gotoAndPlay(50);
});
===========
In this script, what can I add for keyPress(space bar) event?
I hope anyone will help me for this problem.
Copy link to clipboard
Copied
Hi.
You need to add an event listner of the keydown type and check for the space key. Like this:
var _this = this;
_this.stop();
window.addEventListener("keydown", function(e)
{
if (e.code === "Space")
_this.gotoAndPlay(50);
});
I hope this helps.
Regards,
JC
Copy link to clipboard
Copied
Thank you for your help.
=========================
var _this = this;
_this.gotoPlayBtn.on('click', function(){
_this.gotoAndPlay(216);
});
=========================
When I want to use both "mouse click" and "keydown", how can I insert "keydown" in the above script?
I hope you will help me again.
Thank you.
Regards,
buksori