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

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

Explorer ,
Jun 08, 2020 Jun 08, 2020

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.

 

TOPICS
ActionScript

Views

309

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
community guidelines
Community Expert ,
Jun 09, 2020 Jun 09, 2020

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

Votes

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
community guidelines
Explorer ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines