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

Triggering a subclip

Participant ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

On a frame of a canvas timeline I have a movie clip with a subclip animation. It plays fine within the subclip. I am attempting to initiate that animation with a mouse click, but nothing happens. The symbol instance is "pizza" and the button instance is "pizzago." Below is my code. The script is on the same frame as the movieclip I'm trying to play. 

 

var _this = this;
_this.pizzago.on('click', function(){
_this.pizza.play();
});

TOPICS
How to

Views

249

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

Participant , May 12, 2021 May 12, 2021

Finally got it working though it brings up an issue I need to understand better. The script was on the frame and layer where the mc lived. I moved it to my action layer, and suddenly it works. I have had another project work differently depending on placement, and I don't quite grasp why. Something to study unless someone has a suggestion for how to understand that better. Thanks all. 

Votes

Translate

Translate
Community Expert ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

Hi.

 

It should work.

 

Try...

_this.pizza.gotoAndPlay(1);

 

... instead and see if this works.

 

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
LEGEND ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

Add this to your event handler function:

alert(_this.pizza);

 

If it displays "undefined" when you click, things are not as you assume.

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
Participant ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

Didn't get that message, but that sounds like a great way to debug in the future. 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
Participant ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

LATEST

Finally got it working though it brings up an issue I need to understand better. The script was on the frame and layer where the mc lived. I moved it to my action layer, and suddenly it works. I have had another project work differently depending on placement, and I don't quite grasp why. Something to study unless someone has a suggestion for how to understand that better. Thanks all. 

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