Basic usage of commonly used ActionScript control statements in Flash

Source: Internet
Author: User
Many friends often ask about the usage of Flash script statements. Some simple commands can implement some functions. Now I will explain the basic usage of some commonly used flash action statements.

1. Goto: Jump to a specified frame)
Scene: Specifies scene
Frame: Number, label, expression, next frame, and previous frame. You can select the number and label of the frame. The expression is used to indicate the next frame and the previous frame.
Expression: defines the expression.
Control: Go to and play, go to and stop determine whether to continue playing after the specified frame is reached by selecting this item

Example:
Go to and play (1) Jump to the first frame
Go to next frame to jump to the next frame for playing
Go to and stop ("Intro") to jump to the frame broadcast labeled as intro

2. Play: Play
Stop: Stop

Toggle high quality: details of the switching Screen

Stop all sounds: Stop all sounds

Get URL: Open the specified URL
URL: URL
Windows: _ Self, _ blank, _ parent, _ top
Variables on't send, send use get, send use Post Variable Transmission Method

Example:
Get URL ("next. asp", window = "_ blank", vars = post) open next. asp in a new window and PASS Parameters

3. fscommand: Call the command
Command: Command
Arguments: Parameters
For standalone player: Fixed commands and parameters used by fullscreen, allowscale, showmenu, exec, and quit players

Example:
FS command ("fullscreen", "true") sets full-screen playback

4. Load/unload movie: Transfer/Release External videos
Action: Load movie into location, unload movie from location, load variables into location: You can choose whether to transfer a new movie, release the imported movie, and call the variable
URL: the video URL
Location: Level, target: the transferred layer, or the location of a target object
Variables on't send, send use get, send use post: Variable Transmission Method

Example:
Load movie ("test.swf", 1): Call test.swf to the first layer.
Load movie ("test.swf", "loadit", vars = get): Call test.swf to the location of the loadit target object.
Unload movie ("loadit"): releases the film at the loadit target object.
Load variables ("makeit. asp", 2, vars = get): Call makeit. asp and receive the returned variables.

5. Tell target: Specify the target object
Target: target object

Example:
Begin tell target ("OBJ") specifies the target object OBJ
End tell target

6. If frame is loaded: Determines whether a frame is transferred in.
Scene: Specifies the scenario
Frame: Number, label, expression: Specifies the frame, number, or expression.
Expression: Expression

Example:
If frame is loaded (Scene 1, "end ")
End frame loaded
: Determines whether frames labeled as end in scenario 1 are transferred.

7. On mouseeventMouse Time Response
Event Ress, release, release outside, roll over, roll out, drag over, drag out, key press events: Press, open, open outside, Focus Move, remove, drag, drag, and press the button

Example:
On (Press) when you press the mouse
End on
On (key: S) keyboard when S is pressed
End on

8. IfDetermine whether the condition is true
Condition: Condition
Add else/else if clause: Add Else To judge again

Example:
If (A = 10) If a = 10 then ......
End if
If (A = 10) If a = 10 then ...... Otherwise ......
Else
End if

9. LoopLoop
Condition: Condition

Example:
Loop while (A = 10) loop if a = 10
End Loop

10. CallCall function frames or objects
Frame: function frame

Example:
Call ("make") call make FrameProgram

11. Set PropertySet attributes
Set: Y positon, X position, y scale, X scale, Alpha, visibility, rotation, name, high quality, Show focus rectangle, sound buffer time set Y coordinate, X coordinate, Y magnification, x magnification, transparency, visibility, rotation angle, name, fineness, focus rectangle display, sound buffer time (5 seconds by default)
Target: target object
Value: Value

Example:
Set property ("AOE", X position) = "12" sets the X coordinate of the target object AOE to 12
Set property (Show focus rectangle) = "0" clear focus box

12. Set variableSet Variables
Variable: Variable
Value: Value

Example:
Set variable: "test" = 10 set test = 10

13. Duplicate/remove movie clipCopy object
Action uplicate movie clip, remove duplicate movie clip can be copied or deleted
Target: target object
New name: name of the new target object
Depth: Depth

Example:
Duplicate movie clip ("AOE", "aoe2", 1) copy a new AOE animation named aoe2
Remove movie clip ("aoe2") Delete the target object aoe2

14. Drag movie clipDrag a video clip
Start drag operation: Start to drag
Target: target object
Constrain to rectangle: left, top, right, bottom cursor position, top left and bottom right
Lock mouse to center: place the mouse in the center
Stop drag operation stop dragging

Example:
Start drag ("AOE", L = 2, T = 3, r = 4, B = 5) drag the target object AOE at the position of L = 2, T = 3, R = 4, B = 5
Start drag ("AOE", lockcenter): drag the target object AOE, which is located in the center.
Stop drag stop dragging

15. TraceTracking
Message: Information

Example:
Trace ("AOE") displays AOE
Trace (AOE) displays the AOE Value

16. CommentNote
Comment: Comment

Example:
Comment ("computing") Comment: Computing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.