SWiSH Player Support
SWF4 or later - Supported Internally
Syntax
tellTarget(object) {
statement(s);
}
Arguments
object: An Instance of an Object or Sprite.
statement(s): An Action or group of Actions enclosed in curly brackets {...}.
Returns
Nothing.
Description
Action: Allows you to specify an Object (such as a Movie Clip) with the Object parameter. The statements within the tellTarget curly brackets are applied to that Object. This prevents you from having to repeatedly write the Object's name or the path to the Object.
Sample
Consider a Sprite _root.s1. Sprite properties can be accessed from other Sprites or from the root level via the following code:
tellTarget (_root.s1) {
_X += 10; // same as _root.s1._X += 10
_alpha = 40; // same as _root.s1._alpha = 40
}
Note: In Flash the Object is a either a string containing a target OR a target reference. In SWiSH, it is always a target reference. If you want to use a string variable then enclose it in parentheses, as shown below:
who = "mysprite";
tellTarget((who)) {
stop(); // same as mysprite.stop();
}
If you do not use the parentheses around the variable name, it will be treated as a target name instead. In the above example, if you did not put the extra parenthesis around the variable name you would get this:
who = "mysprite";
tellTarget(who) {
stop(); // same as who.stop();
}
See Also
with