T-W > tellTarget

tellTarget

Syntax

tellTarget(target) {
statement;
}

Arguments

target A target path string specifying the Timeline to be controlled.

statement Instructions applied to the targeted Timeline.

Description

Action; applies the instructions specified in the statements argument to the Timeline specified in the target argument. The tellTarget action is useful for navigation controls. Assign tellTarget to buttons that stop or start movie clips elsewhere on the Stage. You can also make movie clips go to a particular frame in that clip. For example, you might assign tellTarget to buttons that stop or start movie clips on the Stage or prompt movie clips to jump to a particular frame.

The tellTarget action is very similar to the with action, except that with takes a movie clip or other object as a target, and tellTarget requires a target path to a movie clip and cannot control objects.

Player

Flash 3 or later. This action is deprecated in Flash 5; use of the with action is recommended.

Example

This tellTarget statement controls the movie clip instance ball on the main Timeline. Frame 1 of the movie clip is blank and has a stop action so that it isn't visible on the Stage. When the button with the following action is clicked, tellTarget tells the playhead in the movie clip ball to go to frame 2 and play the animation that starts there.

on(release) {
	tellTarget("ball") {
		gotoAndPlay(2);
	}
}

See also

with