Copy link to clipboard
Copied
Hello!
I am fairly new to Adobe Animate. I have a presentation im working on for an organizational chart. I have buttons navigating throught a website.
In one area, our Org chart, I am trying to make a button that returns to another frame. However, when I click it, it doesnt move.
I have searched the community forums and troubleshooted what I could. I feel like there is something simple im missing and Im hoping someone can point me in the right direction.
Here is my code snip for this layer/timeline
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.RCCR_Button5.addEventListener("click", fl_ClickToGoToAndStopAtFrame_22.bind(this));
function fl_ClickToGoToAndStopAtFrame_22()
{
this.gotoAndStop(0);
}
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.NVOButton5.addEventListener("click", fl_ClickToGoToAndStopAtFrame_23.bind(this));
function fl_ClickToGoToAndStopAtFrame_23()
{
this.gotoAndStop(97);
}
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.SASButton5.addEventListener("click", fl_ClickToGoToAndStopAtFrame_24.bind(this));
function fl_ClickToGoToAndStopAtFrame_24()
{
this.gotoAndStop(146);
Thanks.
Try moving the code that adds the listeners to the first frame instead.
Copy link to clipboard
Copied
which button's not working?
Copy link to clipboard
Copied
Hello! In the video on the last page I click three buttons. None of them work to bring the slide back to their designated pages and I am unsure why. Let me know if you need any more information, and I am happy to provide anything I can!
Copy link to clipboard
Copied
re-enter their instance names in the properties panel
Copy link to clipboard
Copied
Do they have to be anything specific? The instance name is different than the object name.
Copy link to clipboard
Copied
the instance name needs to match the name used in code. the best way to ensure that is to copy from the code and then paste into the instance name field. make sure there are no spaces copy/pasted.
Copy link to clipboard
Copied
I changed the names to match, and then re- did the code. Im afraid that didnt seem to work either.
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.NVOButton5.addEventListener("click", fl_ClickToGoToAndStopAtFrame_23.bind(this));
function fl_ClickToGoToAndStopAtFrame_23()
{
this.gotoAndStop(97);
}
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.SASButton5.addEventListener("click", fl_ClickToGoToAndStopAtFrame_24.bind(this));
function fl_ClickToGoToAndStopAtFrame_24()
{
this.gotoAndStop(146);
}
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.Client_RelationsButton.addEventListener("click", fl_ClickToGoToAndStopAtFrame_26.bind(this));
function fl_ClickToGoToAndStopAtFrame_26()
{
this.gotoAndStop(0);
}
Copy link to clipboard
Copied
check the developer console for errors.
Copy link to clipboard
Copied
Hi.
Are the buttons and code in the main timeline?
Please let us know.
Regards,
JC
Copy link to clipboard
Copied
I am new, so my Timeline is not super clean im afraid. Which may be my issue. Here is a picture of my timeline. The hilighted button is the one im trying to use, the actions are on frame 193.
Copy link to clipboard
Copied
that's ok.
what's the developer console show when you click a button?
Copy link to clipboard
Copied
When I actually click a button, nothing changes to the below
Copy link to clipboard
Copied
change one button name to xxx in code and in properties panel.
test that button
Copy link to clipboard
Copied
No change 😞
Copy link to clipboard
Copied
and the button code is on frame 193, correct?
Copy link to clipboard
Copied
Thanks.
Which frame is the code for adding event listeners to the buttons is located in?
Copy link to clipboard
Copied
Frame 193 is the frame that both this slide starts on, and the slide for the code actions for the buttons
Copy link to clipboard
Copied
Thanks.
Try moving the code that adds the listeners to the first frame instead.
Copy link to clipboard
Copied
Firstly, thank you so much for your patience in helping me.
I Just want to make sure I am understanding the ask.
My first frame currently has some actions assigned to buttons on that frame.
The frame 196 has buttons assigned to it, and those buttons have code (all on the same frame).
There are no buttons to code on the first frame on these three slides, save for the actions layer, and THAT layer has its own codes for the layers on that frame.
Copy link to clipboard
Copied
I added the listeners to frame 1 as instructed, and it seems to have broken my HTML preview
Copy link to clipboard
Copied
I missed a Bracket!
This fixed the issue!! Thank you!
Copy link to clipboard
Copied
ie, you can't reference an object in a frame when the object hasn't been created on stage.
Copy link to clipboard
Copied
Awesome!
Glad it worked!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now