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

gotoAndPlay() does not work

LEGEND ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

I am not sure why this is not working.

Setup:

  1. one button on main stage -  instance name is nativeAmericanBtn
  2. one movieclip on main stage - instance name is instructions
  • frame 0 has no label and has action this.stop();
  • frame1 has label "start"
  • timeline  at 5 seconds has a 1 sec transition opacity from 100 to 0 

instructionsTimeline.png

I guess I could have use fadeout in code instead or even a timeout function but playing a timeline seemed easy enough. Apparently no since it does not work.

When I use like 13 it works. when I use line 12 it does not work. So the scope is correct. Why then is it not playing the instruction timeline?

Everything else in that function is working.

var nativeSym = new lib.nativeSymbol();

this.nativeAmericanBtn.addEventListener("click", nativeAmericanInfo.bind(this));

function nativeAmericanInfo(){

    this.click = createjs.Sound.play("click", "none", 0, 0, 0, 0.5);

    this.blank.addChild(nativeSym);

    geronimoONOFF = 1;

    nativeSym.geronimoBtn.geronimoHL.visible = false;

    eastmanONOFF = 1;

    nativeSym.eastmanBtn.eastmanHL.visible = false;

    this.gotoAndPlay("pages");

    this.instructions.gotoAndPlay("start"); // this does not work

    //this.instructions.visible = false; // this works

}

Views

2.8K

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 , Jul 30, 2018 Jul 30, 2018

you can use jquery if you add a component or include it:

Screenshot - 7_30_2018 , 12_48_13 PM.png

it's hard to display a cached version using animate test, but it's possible.

Votes

Translate

Translate
Community Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

if your screenshot shows the instructions timeline, put an alert on that 'start' frame and retest.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Good idea! Yes it is the instructions timeline. So, I put in a console.log at the "start" label and I get it in the console and I put another console.log at 5 seconds but I do not get that one. This tells me it is not playing the whole timeline.

So I have another stupid question: Does the main timeline need to be at least the same length than the one of the movie clip for this movie clip whole timeline to show? I would think not but again I am just an Edge Animate CC expert and just now trying Animce CC which puzzles me at times.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

OK. I added several console.log on the timeline and tested 3 times without changing anything and the 3rd time it played properly. so I am very puzzled with that one. Pretty strange behavior.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

But great idea about tracing what is going on in the symbol! Thank you!

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

I just tried a mini setup matching what you described, and it worked fine using this code in the main timeline:

this.bob.addEventListener("click", doBob.bind(this));

function doBob() {

    this.instructions.gotoAndPlay("start");

}

In your code, before the this.instructions.gotoAndPlay line, put console.log(this.instructions);

If the instructions clip (not "timeline") is fully instantiated at this point, the console should display all its properties, including its current frame and the labels array. If not, something is wrong.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Great input that I will use in new projects.

I did put several console logs in the instructions movie clip.

At first i put one at the start label and then one at 5 seconds and only the first one displayed in the console which was strange.

Then I added another console.log at 1 second and it did not show in the console which is strange because I have no stop anywhere on that timeline except on first frame and last frame.

Anyway I tested the file with 2 console logs - not showing the 5s ones then with 3 logs - still nothing

Then I tested it again to be sure and it worked.

So I am wondering - is there a posibility that the code was not replaced properly in the js file at publish time?

I have my browser set to clear the cache at every load, so it should not be that.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

resdesign  wrote

I did put several console logs in the instructions movie clip.

That's not what I suggested. By putting a log in the click event handler, you can verify that it is trying to talk to something that actually exists.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Yes I saw that and I will use that in new flas but in this case, since I got the log to work when in put in the symbol, obviously it was present. It is just still pretty strange that it would show the first log and not the others as I mentioned especially since there was no stop on the timeline.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

LATEST

and it is working perfectly now for some reason for all my pages.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Another unrelated question. Could I use jquery each() for multiple buttons or a function that calls several buttons doing something similar to different symbols?

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 Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

you can use jquery if you add a component or include it:

Screenshot - 7_30_2018 , 12_48_13 PM.png

it's hard to display a cached version using animate test, but it's possible.

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 ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Thanks! Good to know.

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