JavaScript problem with Object dissapearing

Community Beginner ,
Oct 10, 2021 Oct 10, 2021

Copy link to clipboard

Copied

I am working on a project using JavaScript using Adobe Animate. I tried entering the JavaScript by hand coding which did not work. Next I went to a code wizard with not much luck either.

What I have is a interface Called Oil Facts which is landscape view. In the top left corner I have a clip saved as a movie which shows a cutaway of a engine running. I don't want the engine to be visible until the user clicks a button called engineRun. The movie of the engine running is called engine. The problem is when the engineRun button is clicked the engine appears and is animated but for a few seconds. I want the engine to stay visible and animated after the user clicks the button.

 

Any ideas what could be done here please. I am using Code snippets, also I created

 

a label in the first frame of the movie clip named engine which I called motorGo but the animation again appears working for a few seconds then dissapears.

 

I want the engine to continue running.

 

 

 

this.engine.visible = false;

 

this.engineRun.addEventListener("click", fl_ClickToShow_4.bind(this));

 

 

function fl_ClickToShow_4()

 

{

 

this.engine.visible = true;

 

this.gotoAndPlay(motorGo);

 

}


Below is the project image which is created in Adobe Animate which uses JavaScript for its scripting language, Animate is basically Adobe Flash with a tuxedo,..rebranded.

Both the engine and the oil can are animations I do not want to appear until the user clicks the button associated.

CompleteScreen Shot 2021-10-09 at 4.23.49 PM.png

Views

35

Likes

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

Adobe Community Professional , Oct 11, 2021 Oct 11, 2021
engine should be a movieclip with its animation needs its own timeline. engine movieclip should appear on a keyframe of the timeline that contains your code it should appear in no other keyframe its instance name (in the properties panel) needs to be engine and this.gotoAndPlay(... needs to be this.engine.gotoAndPlay(...

Likes

Translate

Translate
Adobe Community Professional ,
Oct 11, 2021 Oct 11, 2021

Copy link to clipboard

Copied

LATEST

engine should be a movieclip with its animation needs its own timeline.

engine movieclip should appear on a keyframe of the timeline that contains your code

it should appear in no other keyframe

its instance name (in the properties panel) needs to be engine

and this.gotoAndPlay(... needs to be this.engine.gotoAndPlay(...

Likes

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