![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
When you write a script, you use the Actions panel to attach the script to a frame on a Timeline, or to a button or movie clip on the Stage. Scripts attached to a frame run, or execute, when the playhead enters that frame. However, scripts attached to the first frame of a SWF file may behave differently from those attached to subsequent frames, because the first frame in a SWF file is rendered incrementallyobjects are drawn on the Stage as they download into Flash Playerand this can affect when actions execute. All frames after the first frame are rendered all at once, when every object in the frame is available.
Scripts attached to movie clips or buttons execute when an event occurs. An event is an occurrence in the SWF file such as a mouse movement, a keypress, or a movie clip being loaded. You can use ActionScript to find out when these events occur and execute specific scripts depending on the event. For more information, see Handling Events.
To perform an action depending on whether a condition exists, or to repeat an action, you can use if
, else
, else if
, for
, while
, do while
, for..in
, or switch
statements, which are briefly described in the rest of this section.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |