Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

What can I use for ((keyPress "<Space>")) ?

Explorer ,
Jun 08, 2020 Jun 08, 2020

===========================
<<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.

 

TOPICS
ActionScript
396
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2020 Jun 09, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 11, 2020 Jun 11, 2020
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines