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

AS3 to HTML5 - very simple code

Community Beginner ,
Aug 17, 2018 Aug 17, 2018

Copy link to clipboard

Copied

Hi everyone,

I'm not really able to write codes but I really need your help in order to translate this very simple Action Script 3 code into an HTML5 one.

Thank you!

stop();

stage.addEventListener(MouseEvent.CLICK, _onStageMouseDown);

function _onStageMouseDown(e:MouseEvent):void

{

    nextFrame();

}

Views

562

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

correct answers 1 Correct answer

Community Expert , Aug 17, 2018 Aug 17, 2018

Hi.

One way would be this:

this.stop();

stage.on("stagemousedown", onStageMouseDown);

function onStageMouseDown(e)

{

    exportRoot.gotoAndStop(exportRoot.currentFrame + 1);

}

Please don't hesitate to ask if you still have any further questions.

Regards,

JC

Votes

Translate

Translate
Community Expert ,
Aug 17, 2018 Aug 17, 2018

Copy link to clipboard

Copied

Hi.

One way would be this:

this.stop();

stage.on("stagemousedown", onStageMouseDown);

function onStageMouseDown(e)

{

    exportRoot.gotoAndStop(exportRoot.currentFrame + 1);

}

Please don't hesitate to ask if you still have any further questions.

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
Community Beginner ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

Thank you very much Joao!

It works perfectly!!

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
Community Beginner ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

B the way, do you know how would the code change when, instead of the stage, I click into a movieclip?

So that when you click inside the movieclip it goes to framenumber+1 (related to the movieclip timeline).

I tried in this manner (scena01 is the movieclip) but it does not work:

this.stop();

this.scena01.addEventListener("click", fl_ClickToGoToAndStopAtFrame_17.bind(this));

function fl_ClickToGoToAndStopAtFrame_17()

{

    this.gotoAndStop(this.currentFrame + 1);

}

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

LATEST

I would assume that you have to point to the actual movie clip you are targeting but I am less familiar with AS3 than canvas.

this.movieclipname.gotoAndStop(this.currentFrame + 1);

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