Ръководство за работа Отказ

How to use ActionScript with Animate

  1. Adobe Animate User Guide
  2. Introduction to Animate
    1. What's New in Animate
    2. Visual Glossary
    3. Animate system requirements
    4. Animate keyboard shortcuts
    5. Work with Multiple File Types in Animate
  3. Animation
    1. Animation basics in Animate
    2. How to use frames and keyframes in Animate
    3. Frame-by-frame animation in Animate
    4. How to work with classic tween animation in Animate
    5. Brush Tool
    6. Motion Guide
    7. Motion tween and ActionScript 3.0
    8. About Motion Tween Animation
    9. Motion tween animations
    10. Creating a Motion tween animation
    11. Using property keyframes
    12. Animate position with a tween
    13. How to edit motion tweens using Motion Editor
    14. Editing the motion path of a tween animation
    15. Manipulating motion tweens
    16. Adding custom eases
    17. Creating and applying Motion presets
    18. Setting up animation tween spans
    19. Working with Motion tweens saved as XML files
    20. Motion tweens vs Classic tweens
    21. Shape tweening
    22. Using Bone tool animation in Animate
    23. Work with character rigging in Animate
    24. How to use mask layers in Adobe Animate
    25. How to work with scenes in Animate
  4. Interactivity
    1. How to create buttons with Animate
    2. Convert Animate projects to other document type formats
    3. Create and publish HTML5 Canvas documents in Animate
    4. Add interactivity with code snippets in Animate
    5. Creating custom HTML5 Components
    6. Using Components in HTML5 Canvas
    7. Creating custom Components: Examples
    8. Code Snippets for custom Components
    9. Best practices - Advertising with Animate
    10. Virtual Reality authoring and publishing
  5. Workspace and workflow
    1. Creating and managing Paint brushes
    2. Using Google fonts in HTML5 Canvas documents
    3. Using Creative Cloud Libraries and Adobe Animate
    4. Use the Stage and Tools panel for Animate
    5. Animate workflow and workspace
    6. Using web fonts in HTML5 Canvas documents
    7. Timelines and ActionScript
    8. Working with multiple timelines
    9. Set preferences
    10. Using Animate authoring panels
    11. Create timeline layers with Animate
    12. Export animations for mobile apps and game engines
    13. Moving and copying objects
    14. Templates
    15. Find and Replace in Animate
    16. Undo, redo, and the History panel
    17. Keyboard shortcuts
    18. How to use the timeline in Animate
    19. Creating HTML extensions
    20. Optimization options for Images and Animated GIFs
    21. Export settings for Images and GIFs
    22. Assets Panel in Animate
  6. Multimedia and Video
    1. Transforming and combining graphic objects in Animate
    2. Creating and working with symbol instances in Animate
    3. Image Trace
    4. How to use sound in Adobe Animate
    5. Exporting SVG files
    6. Create video files for use in Animate
    7. How to add a video in Animate
    8. Draw and create objects with Animate
    9. Reshape lines and shapes
    10. Strokes, fills, and gradients with Animate CC
    11. Working with Adobe Premiere Pro and After Effects
    12. Color Panels in Animate CC
    13. Opening Flash CS6 files with Animate
    14. Work with classic text in Animate
    15. Placing artwork into Animate
    16. Imported bitmaps in Animate
    17. 3D graphics
    18. Working with symbols in Animate
    19. Draw lines & shapes with Adobe Animate
    20. Work with the libraries in Animate
    21. Exporting Sounds
    22. Selecting objects in Animate CC
    23. Working with Illustrator AI files in Animate
    24. Applying blend modes
    25. Arranging objects
    26. Automating tasks with the Commands menu
    27. Multilanguage text
    28. Using camera in Animate
    29. Graphic filters
    30. Sound and ActionScript
    31. Drawing preferences
    32. Drawing with the Pen tool
  7. Platforms
    1. Convert Animate projects to other document type formats
    2. Custom Platform Support
    3. Create and publish HTML5 Canvas documents in Animate
    4. Creating and publishing a WebGL document
    5. How to package applications for AIR for iOS
    6. Publishing AIR for Android applications
    7. Publishing for Adobe AIR for desktop
    8. ActionScript publish settings
    9. Best practices - Organizing ActionScript in an application
    10. How to use ActionScript with Animate
    11. Accessibility in the Animate workspace
    12. Writing and managing scripts
    13. Enabling Support for Custom Platforms
    14. Custom Platform Support Overview
    15. Working with Custom Platform Support Plug-in
    16. Debugging ActionScript 3.0
    17. Enabling Support for Custom Platforms
  8. Exporting and Publishing
    1. How to export files from Animate CC
    2. OAM publishing
    3. Exporting SVG files
    4. Export graphics and videos with Animate
    5. Publishing AS3 documents
    6. Export animations for mobile apps and game engines
    7. Exporting Sounds
    8. Best practices - Tips for creating content for mobile devices
    9. Best practices - Video conventions
    10. Best practices - SWF application authoring guidelines
    11. Best practices - Structuring FLA files
    12. Best Practices to optimize FLA files for Animate
    13. ActionScript publish settings
    14. Specify publish settings for Animate
    15. Exporting projector files
    16. Export Images and Animated GIFs
    17. HTML publishing templates
    18. Working with Adobe Premiere Pro and After Effects
    19. Quick share and publish your animations
  9. Troubleshooting
    1. Fixed issues
    2. Known issues

 

Getting started with ActionScript

The ActionScript® scripting language lets you add complex interactivity, playback control, and data display to your application. You can add ActionScript in the authoring environment by using the Actions panel, Script window, or an external editor.

ActionScript follows its own rules of syntax, reserved keywords, and lets you use variables to store and retrieve information. ActionScript includes a large library of built‑in classes that let you create objects to perform many useful tasks. For more information on ActionScript, see the following Help titles:

You do not have to understand every ActionScript element to begin scripting. If you have a clear goal, you can start building scripts with simple actions.

ActionScript and JavaScript are both rooted in the ECMA-262 standard, the international standard for the ECMAScript scripting language. For this reason, developers who are familiar with JavaScript can find ActionScript immediately familiar. For more information about ECMAScript, go to ecma-international.org.

Which version of ActionScript can you use?

Animate includes more than one version of ActionScript to meet the needs of different kinds of developers and playback hardware. ActionScript 3.0 and 2.0 are not compatible with each other.

 

  • ActionScript 3.0 executes fast. This version requires more familiarity with object-oriented programming concepts than the other ActionScript versions. ActionScript 3.0 is fully compliant with the ECMAScript specification, offers better XML processing, an improved event model, and an improved architecture for working with onscreen elements. FLA files that use ActionScript 3.0 cannot include earlier versions of ActionScript.

  • (Deprecated with Animate only) ActionScript 2.0 is simpler to learn than ActionScript 3.0. Although Flash Player runs compiled ActionScript 2.0 code slower than compiled ActionScript 3.0 code, ActionScript 2.0 is still useful for many kinds of projects. ActionScript 2.0 is also useful for the projects that are not computationally intensive. For example, more design-oriented content. ActionScript 2.0 is also based on the ECMAScript specification, but is not fully compliant.

  • (Deprecated with Animate) ActionScript 1.0 is the simplest form of ActionScript, and is still used by some versions of the Adobe Flash Lite Player. ActionScript 1.0 and 2.0 can coexist in the same FLA file.

  • (Deprecated with Animate) Flash Lite 2.x ActionScript is a subset of ActionScript 2.0 supported by Flash Lite 2.x on mobile phones and devices.

  • (Deprecated with Animate) Flash Lite 1.x ActionScript is a subset of ActionScript 1.0 supported by Flash Lite 1.x on mobile phones and devices.

 

Using the ActionScript documentation

Due to multiple versions of ActionScript (2.0 and 3.0), and multiple ways of incorporating it into your FLA files, there are different ways to learn ActionScript.

You can find description about the graphical user interface for working with ActionScript. This interface includes the Actions panel, Script window, Script Assist mode, Behaviors panel, Output panel, and Compiler Errors panel. These topics apply to all versions of ActionScript.

Other ActionScript documentation from Adobe guides you to learn about the individual versions of ActionScript.

Ways of working with ActionScript

There are several ways to work with ActionScript.

  • (Deprecated with Animate) Script Assist mode lets you add ActionScript to your FLA file without writing the code yourself. You select actions, and the software presents you with a user-interface for entering the parameters required for each one. Learn a little about what functions to use to accomplish specific tasks, but you don’t have to learn syntax. Many designers and non-programmers use this mode.

  • (Deprecated with Animate) Behaviors also let you add code to your file without writing it yourself. Behaviors are prewritten scripts for common tasks. You can add a behavior and then easily configure it in the Behaviors panel. Behaviors are available only for ActionScript 2.0 and earlier.

  • Writing your own ActionScript gives you the greatest flexibility and control over your document. But, it requires you to become familiar with the ActionScript language and conventions.

  • Components are prebuilt movie clips that enable you to implement complex functionality. A component can be a simple user interface control, such as a check box, or it can be a complicated control, such as a scroll pane. You can customize a component’s functionality and appearance, and you can download components created by other developers. Most components require you to write some ActionScript code of your own to trigger or control a component. For more information, see Using ActionScript 3.0 Components.

 

Writing ActionScript

When you write ActionScript code in the authoring environment, you use the Actions panel or Script window. The Actions panel and Script window contain a full-featured code editor that includes code hinting and coloring, code formatting, and syntax highlighting features. It also contains debugging, line numbers, word wrapping, and support for Unicode.

  • Use the Actions panel to write scripts that are part of your Animate document (that is, scripts that are embedded in the FLA file). The Actions panel provides features such as the Actions toolbox, which gives you quick access to the core ActionScript language elements. You get prompts for the elements that require to create scripts.

  • Use the Script window if you want to write external scripts—that is, scripts or classes that are stored in external files. (You can also use a text editor to create an external AS file.) The Script window includes code-assistance features such as code hinting and coloring, syntax checking, and auto-formatting.

More recommended community content

The following articles and tutorials provide more detailed information about working with ActionScript:

Overview of the Output panel

When you execute any doc type, the Output panel displays information or warning related to operations such as document conversions and publish. To display this information, add trace() statements to your code or use the List Objects and List Variables commands.

If you use the trace() statement in your scripts, you can send specific information to the Output panel when the SWF file runs. It includes notes about the status of the SWF file status or the value of an expression. 

The Output panel consists of the following menu items:

  • Copy: Copies all the contents of the Output panel to the clipboard of computer. To copy a selected portion of the output, select the area you want to copy and then select Copy.
  • Clear: Clears the content of the output panel.
  • Show Output: Displays the content of the output panel.
  • Lock: Locks the panel. You can only resize the panel but you cannot move or drag the panel. 
  • Help: Loads the online Help for the output panel.
  • Close: Closes the output panel.
  • Close Group: Closes the whole panel group. You can simultaneously dock multiple panels such as timeline, output panel, and compiler errors panel.

To display or hide the output panel, select Window > Output or press F2.

Actions panel

Looking for the Language Reference?

To find reference documentation for a specific ActionScript language element, do one of the following:

  • Open the ActionScript 3.0 Language Reference, and search for the language element.

  • Type the language element in the Actions panel, select it, then press F1 (Press F1 immediately).

Learning ActionScript

To learn about writing ActionScript, use these resources:

 ActionScript 3.0 and 2.0 are not compatible with each other. Choose only one version for each FLA file you create.

Overview of the Actions panel

To create scripts embedded in a FLA file, enter ActionScript directly into the Actions panel (Window > Actions or press F9).

The Actions panel consists of two panes:

Script pane

Lets you type ActionScript code, which is associated with the currently selected frame.

Script navigator

Lists the scripts in your Animate document, and lets you move quickly between them. To view the script in the Script pane, click an item in the Script navigator.

The Actions panel lets you access the code-assistance features that simplify and streamline coding in ActionScript. You can add non-frame specific global and third-party scripts that can be applied to the whole animation from within Animate. For more information, see Adding Global and Third-party scripts section in this page. 

  • Run Script: Runs the script
  • Pin Script: Pins the script to the pin tabs of individual scripts in the Script pane and move them accordingly. This feature is useful if you have not organized the code within your FLA file into one central location. Or, it is useful if you are using multiple scripts. You can pin a script to retain the open location of the code in the Actions panel and toggle between the various open scripts. This feature can be useful when debugging.
  • Insert Instance Path and Name: Helps you set an absolute or relative target path for an action in the script.
  • Find: It finds and replaces text in your script.
  • Format Code: Helps to format the code.
  • Code Snippets: Opens the Code Snippets panel that displays sample code snippets.
  • Add using wizard: Click this button to add actions using an easy-to-use wizard without having to write code. 
  • Help: Displays reference information for the ActionScript element that is selected in the Script pane. For example, if you click an import statement and then click Help, the reference information for import appears in the Help panel.

Using actions code wizard

You can add interactivity to HTML5 compositions with the Add using wizard options in Actions panel. Add using wizard is a simplified user interface to add code to your compositions.

  1. Create an HTML5 canvas document and click Window > Actions.

  2. Click Add using wizard in Actions panel as shown in the following screenshot. 

    Actions panel with Add using wizard button

  3. Select an action for which you want to create code using the code wizard.

    A sample screenshot displaying action code wizard options for actions

    In the above screenshot, Get frame number action is selected and the corresponding code has been updated in action window.

    Based on the action type you select, you can also choose the corresponding object for which you want to apply the action. You can search for specific objects on stage if the object has an instance name. Also, you can apply the action on the current selection. 

    List of objects on which to apply action

  4. Click Next to choose a triggering event. A set of trigger events are listed in the window based on your action type and object type selection in previous steps. 

    List of triggering events

  5. Choose an appropriate trigger event followed by its corresponding triggering objects, if any, and click Finish and add button. 

You can choose the Current Selection option from the menu when you select an object in the stage and run the actions code wizard. You can also choose the timeline and components actions for the code.

Enhance the interactivity of an Animation

Interactivity is an essential part of an animation that boosts the visual experience of the audience. Want to learn how to introduce actions to the video without any codes? Watch the tutorial at the end of this example and follow these steps.

  1. In the Timeline, select the action clip.

  2. Click Windows > Actions.

  3. Click Add using wizard in Actions pane.

  4. In Current Frame, select the following options:

    • Select an action: Select Play.
    • Object on which to apply the action: Select the required object.
  5. Click Next.

How to add interactivity to your animations

Watch the video to learn about more actions like play, move vertically, and position the object.

Using script window

The Script window lets you create external script files that you import into your application. These scripts can be ActionScript or Animate JavaScript files.

You can also add Global and Third-party scripts in HTML5 canvas documents. For more information, see Adding Global and Third-party scripts section in Create and publish HTML5 Canvas documents in Animate

If you have more than one external file open, filenames are displayed on tabs across the top of the Script window.

In the Script window, you can use PinScript, find and replace, syntax coloring, format code, code hinting and commenting, and code collapse features. You can also use debug options (ActionScript files only), and word wrap. The Script window also lets you display line numbers and hidden characters.

Create an external file in the Script window

  1. Select File > New.

  2. Choose an intent of your choice from the tabs at the top of the screen such as Character Animation, Social, Game, Education, Ads, Web, and Advanced. Select the type of external file you want to create (ActionScript file or Animate JavaScript file).

Edit an existing file in the Script window

  • To open an existing script, select File > Open, and then open an existing AS file.

  • To edit a script that is already open, click the document tab that shows the script’s name.

Tools in the Actions panel and script window

The Actions panel let you access the code-assistance features that simplify and streamline coding in ActionScript.

Find 

Finds and replaces text in your script.

 

Insert Target Path 

(Actions panel only) Helps you set an absolute or relative target path for an action in the script.

 

Help 

Displays reference information for the ActionScript element that is selected in the Script pane. For example, if you click an import statement and then click Help, the reference information for import appears in the Help panel.

 

Code Snippets

Opens the Code Snippets panel that displays sample code snippets.

 

Add using wizard

Helps you to add code for actions using an interface without having to write code. 

Accessing context-sensitive Help from the Actions panel

  1. To select an item for reference, do any of the following:
    • Select an ActionScript term in the Actions panel toolbox pane (on the left side of the Actions panel).

    • Select an ActionScript term in the Actions panel in the Script pane.

    • Place the insertion point before an ActionScript term in the Actions panel in the Script pane.

  2. To open the Help panel reference page for the selected item, do one of the following:
    • Press F1.

    • Right-click the item and select View Help.

    • Click Help  above the Script pane.

Set ActionScript preferences

Whether you edit code in the Actions panel or the Script window, you can set and modify a single set of preferences.

  1. Select Edit > Preferences (Windows) or Animate > Preferences (Macintosh), and then click Code Editor in the Category list.

  2. Set any of these preferences:

    Automatic Indentation

    When automatic indentation is turned on, the text you type after an opening parenthesis “(“ is automatically indented to the Tab Size setting. This behavior is also applicable when you use opening curly bracket “{“.

    Tab Size

    Specifies the number of characters a new line is indented.

    Code Hints

    Enables code hinting in the Script pane.

    Delay

    Specifies the delay (in seconds) before code hints are displayed. The option is deprecated with Animate.

    Font

    Specifies the font used for your script.

    Open/Import

    Specifies the character encoding used when you open or import ActionScript files.

    Save/Export

    Specifies the character encoding used when you save or export ActionScript files.

    Reload Modified Files

    Specifies what happens when a script file is modified, moved, or deleted. Select Always, Never, or Prompt.

    Always

    No warning is displayed, and the file is automatically reloaded.

    Never

    No warning is displayed, and the file remains in the current state.

    Prompt

    (Default) A warning is displayed, and you can choose whether to reload the file.

    When you build applications with external scripts, this preference enables you to avoid overwriting a script. Or avoid publishing the application with older versions of scripts. The warnings let you automatically close a script and reopen the newer, modified version.

    Syntax Colors

    Specifies code coloring in your scripts.

    ActionScript 3.0 Settings

    These buttons open the ActionScript Settings dialog boxes, where you can set source path, library path, and external library path for ActionScript 3.0.

 Adobe

Получете помощ по-бързо и по-лесно

Нов потребител?

Adobe MAX 2024

Adobe MAX
Конференцията, посветена на креативността

14 – 16 октомври, Маями Бийч и онлайн

Adobe MAX

Конференцията, посветена на креативността

14 – 16 октомври, Маями Бийч и онлайн

Adobe MAX 2024

Adobe MAX
Конференцията, посветена на креативността

14 – 16 октомври, Маями Бийч и онлайн

Adobe MAX

Конференцията, посветена на креативността

14 – 16 октомври, Маями Бийч и онлайн