Copy link to clipboard
Copied
Hello!
I am working in Adobe Animate to help create interactive, educational exe files that showcase animation, audio and video as well as allow for the user to control the flow of content via skip forward, skip backward, pause, play and volume buttons. I have already found tons of success through the Adobe Support community in setting up animation and audio with Animate along with getting the controls set up to be coded with AS3 and for that I am eternally grateful.
I understand that what I am attempting to achieve will be difficult in terms of video integration on an AS3 file, so I may be forced to animate in program rather than importing video to Animate from after effects. However I've run into a situation where I cannot seem to understand the workflow for using Actionscript 3 with Animate and I was wondering if there are any resources out there for using AS3 alongside Adobe Animate 2022? Relying on old videos of people using AS3 with flash don't seem to produce the intended results and I can't tell if the architecture keeps changing or if I just can't seem to understand the code. Even a lot of our old projects in office circa 2012-2013 break upon opening the fla file, so looking back at old projects for guidance feels like a dead end.
I have already bookmarked the AS3 Reference and the AS3 Developer's Guide, have done countless hours of research, debugging and video watching though I'm running into a continuous problem with understanding AS3 syntax and how it relates to layers on the timeline, symbols and scenes, and labels/instances/properties/actionscript classes. There also appears to be a discrepancy in a lot of the answers I read pertaining to starting code via importing packages vs. using simple commands such as gotoAndplay().
As an example of an area of trouble, I have attached a gif file of a simple button interaction that takes place within a movie clip across 100 frames. I intend to loop through these 100 frames until the user interacts with the button, forcing a jump to the frame at the beginning of a fade out into the full interactive animation.
There are 4 layers within this movie clip: The Title (static text), the grey/transparent screen underlay (png bitmap), the button & its start text (motion tween for glow effect, button), and the actions layer. The button glows blue, has instances of green coloring on hover and light orange on click, and begins a fade out after 100 frames. I have a very simple sample script previously sourced from an answer on these forums, however it does not seem to do what I intend and I cannot understand why.
Frame 99 (frame 1 script is identical minus the gotoAndPlay function)
gotoAndPlay("SplashScreen");
this.SplashScreen.startBtn.addEventListener(MouseEvent.CLICK,dostart);
function dostart(e:MouseEvent){
startBtn.removeEventListener(MouseEvent.CLICK,dostart);
gotoAndPlay("Fade");
}
Looking at the gif, the video will play through the first 100 frames, will not listen for a click and will cycle through the colors of the button once the video continues through the fade out. All of which are unintended functionality.
Here's a sample project so you can see what I'm working with if you feel so inclined to assist.
I guess long story short, are there resources that help explain the AS3 integration and workflow rather than just tell me what the answer to my Actionscript problem would be?
2 Correct answers
Hi.
Here are some references that I hope will get you started.
- Doug Winnie (ActionScript 1:1): https://www.youtube.com/watch?v=cX83rCeCz4A&list=PL6918DF35C37C7911&ab_channel=AdobeActionScript
- Lee Brimelow (GotoAndLearn): https://web.archive.org/web/20121103120547/http://www.gotoandlearn.com/
- LinkedIn Learning has some great video courses (special mention to Joseph Labrecque): https://www.
- Pluralsight also have some great video courses: https://www.
this object
this.SplashScreen.startBtn
must exist in the frame where this code executes:
ie, if
this.SplashScreen.startBtn
exists on the SplashScreen frame and is not the same object on the frame with the code, your code will fail.
Copy link to clipboard
Copied
that listener needs to be on a frame where dispatching object exists.
Copy link to clipboard
Copied
Thank you for the reply! My apologies for my own confusion, but by dispatching object, do you mean the startBtn since the act of clicking it would dispatch the program to the intended frame in the timeline? Or am I misinterpreting?
Also, does this suggest putting it on the exact same frame on the layer with the object, or is an action layer spanned over the object an acceptable use case? I'm mainly trying to figure out the distinction between applying action code to movie clips versus the original objects
Copy link to clipboard
Copied
this object
this.SplashScreen.startBtn
must exist in the frame where this code executes:
ie, if
this.SplashScreen.startBtn
exists on the SplashScreen frame and is not the same object on the frame with the code, your code will fail.
Copy link to clipboard
Copied
Just dropping in to say I took your advice and added the code over the splash screen symbol timeline where the play button was held and the code in fact worked properly! I sincerely appreciate your help, kglad!
For reference, and in case anyone else has a similar issue, I had to do a few things in order to get the code to work properly. I had to change the instance name due to an error where the 'SplashScreen' symbol had the same linkage as 'SplashScreen_graphic', an item which was no longer in my project, and no matter what the instance name of the SplashScreen symbol became, this error would pop up. So I stripped the SplashScreen symbol of its as3 linkage, renamed the button from startBtn to testbutton to prevent further linkage issues, put the action code in an action span above the button, and made sure the action was in the same timeline as the button since symbols can all have their own respective timelines called upon within a main timeline or scene. Here's the implemented code that fixed the issue:
testbutton.addEventListener(MouseEvent.CLICK, dostart);
function dostart(e: MouseEvent) {
testbutton.removeEventListener(MouseEvent.CLICK, dostart);
gotoAndPlay(100);
}
I couldn't get the button to stop cycling through its action frames (Up, down, hover and hit) so I just duplicated the button layer and made it a classic tween to handle opacity as it transitions out and that worked quite well.
Thank you for your assistance! I know what I was trying to do is simple, but I greatly appreciate the advice!
Copy link to clipboard
Copied
you're welcome. (but it sounds like you had quite a bit more to resolve.)
Copy link to clipboard
Copied
Yeah, you could say that... Any chance you know for what purpose the 'export for actionscript' function under an object properties would be used? Or if there's a way to see all of a project's current linkages/instance names?
Two examples I've found for determining linkage/instance names are the library (which you can change on the fly) and when you export as an swf (which seems relatively inconsistent to rely on with a tall timeline). I can check object properties, though if I'm trying to quick find something that has a specific instance name in a sea of layers, this can often take a while. There's also a target option in the actionscript panel, however it really only shows instance names for symbols and I'm hoping to find like, a list of instance names for all objects/layers
Copy link to clipboard
Copied
export for actionscript is most commonly used to associate a symbol with a class file.
and yes, you can use as3 to get a list of all instance names.
Copy link to clipboard
Copied
Hi.
Here are some references that I hope will get you started.
- Doug Winnie (ActionScript 1:1): https://www.youtube.com/watch?v=cX83rCeCz4A&list=PL6918DF35C37C7911&ab_channel=AdobeActionScript
- Lee Brimelow (GotoAndLearn): https://web.archive.org/web/20121103120547/http://www.gotoandlearn.com/
- LinkedIn Learning has some great video courses (special mention to Joseph Labrecque): https://www.
- Pluralsight also have some great video courses: https://www.
- My repo on GitHub that contains the source codes and files of some games, apps, and other stuff;
- I also have a YouTube channel that you may find useful;
- O'Reilly and Packt have lots of books about Flash, AS3, Animate, and so on, in paper or in a subscription fashion.
Regards,
JC
Copy link to clipboard
Copied
Thanks a ton for handing off these resources! I'll have a dive into the actionscript series to start, work down the line and continue to ask questions if they arise!
Copy link to clipboard
Copied
Excellent! Just let us know every time a question arises.

