Copy link to clipboard
Copied
HI Everyone,
I'm currently trying to convert an HTML5 Canvas to action script 3.0. I successfully converted the document, but now that I'm trying to change all the code I'm encountering problems. What I am trying to do is apply a 'Stop' script to several different frames. At each of these frames, there are also buttons that I am trying to apply a 'Go to and Play' script to. However, when I applied these two code snippets to the first frame of my document and tested it, the 'Stop' script worked, but the button with the 'Go to and Play' script did not. I can click the button as many times as I want, but nothing happens. I tried leaving this code the way it was and applying the same two code snippets to the next spot where I want my animation to stop, but when I tested it, I got an 1120 error for the second button, and neither of the 'Stop' scrips nor the 'Go to and Play" scripts worked. I'm using Action script 3.0 code snippets, and both buttons have different names and instance names. I'm posting some screen shots below so you can see what I'm doing.
function fl_...(){
trace(event);
goto...
}
Copy link to clipboard
Copied
disable advanced layers (modify>document>untick 'use advanced layers') or read about how to edit your code, Create timeline layers with Animate CC
Copy link to clipboard
Copied
Hi kglad,
Thanks for the suggestion. I tried disabling advanced layers, and though I no longer get the 1120 error, the button with the 'Go to and Play' script still doesn't work. Any more thoughts?
Copy link to clipboard
Copied
html5 frame numbers are 1 less than as3 frame numbers. did you make that adjustment?
Copy link to clipboard
Copied
Yes, I did. All frame numbers within the code are correct.
Copy link to clipboard
Copied
use the trace function to confirm your button actually is working.
Copy link to clipboard
Copied
Ok, but what would I be tracing? Once I've traced it, how do I translate the data into knowing if my button is working or not?
Copy link to clipboard
Copied
put a trace in your event listener to confirm the button you think you are clicking, you are clicking. once that's confirmed, put a trace on the target frame to confirm that frame is, in fact, played.
Copy link to clipboard
Copied
I'm afraid this has passed my skill level in Adobe Animate. Here is my code below. Maybe you could use it to show me how to do what you suggested.
/* Stop at This Frame
The Animate timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/
stop();
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
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.
*/
BeginningPlay.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
{
gotoAndPlay(2);
}
Copy link to clipboard
Copied
function fl_...(){
trace(event);
goto...
}
Copy link to clipboard
Copied
Hi kglad,
I just found out that I don't have to convert my project to Action Script after all. However I would like to thank you for all your help in this matter. Hopefully these posts will help someone else in the future,
-Micah
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now