ReferencecallAction

<callAction>

<callAction> is a General Operator component that triggers an action based on a click interaction or a specified boolean condition. The available actions are:

  • addChildren: Adds one or more children to the target component.
  • deleteChildren: Deletes one or more children from the target component.
  • submitAnswer: Submits the target answer component.
  • resample: Resamples the target component.
  • startAnimation: Starts the animation of the target component.
  • stopAnimation: Stops the animation of the target component.
  • toggleAnimation: Toggles the animation of the target component.
  • playVideo: Plays the target video component.
  • pauseVideo: Pauses the target video component.
  • navigateToTarget: Navigates to a specified target, such as a reference link.
  • copyDoenetMLToClipboard: Copies the DoenetML of the target component to the clipboard.

Attributes and Properties

Attributes for <callAction>
AttributeTypeValues
actionName = "…"text
anchor = "…"point
draggable = "…"boolean"true" "false"
labelIsName = "…"boolean"true" "false"
number = "…"
numbers = "…"
positionFromAnchor = "…"text"upperright" "upperleft" "lowerright" "lowerleft" "top" "bottom" "left" "right" "center"
target = "…"
triggerWhen = "…""true" "false"
triggerWhenObjectsClicked = "…"
triggerWhenObjectsFocused = "…"
triggerWith = "…"
Props for <callAction name="c">
PropertyType
$c.actionNametext
$c.anchorpoint
$c.disabledboolean
$c.draggableboolean
$c.fixedboolean
$c.fixLocationboolean
$c.hiddenboolean
$c.labellabel
$c.labelIsNameboolean
$c.positionFromAnchortext

Example: Add a <point> child to a <graph>

Each time the <callAction> button is clicked, a new <point> child is added to the graph at (2,3)(2,3).


Example: Delete a <point> child from a <graph>

Each time the second <callAction> button is clicked, a <point> child that was added previously is deleted from the <graph>.


Example: Perform multiple actions with one click

Multiple <callActions> can be performed with the action of one button click when grouped together inside a <triggerSet> component.


Example: Generate new random numbers

Each time the <callAction> button is clicked, the <sampleRandomNumbers/> component is resampled.


Attribute Example: labelIsName

Using the labelIsName attribute is a shortcut to adding a separate <label> child to the <callAction> component.


Attribute Example: anchor

The anchor attribute specifies the position of the <callAction> button when the <callAction> is used inside a <graph>.


Attribute Example: actionName

The actionName attribute specifies the action to be performed by the <callAction> component.


Attribute Example: actionName=“resample”

The resample specification for the actionName acts on the <sampleRandomNumbers> component to generate a new set of random numbers.


Attribute Example: actionName=“addChildren”

The addChildren specification for the actionName attribute creates one or more children of the target component.


Attribute Example: actionName=“deleteChildren”

The deleteChildren specification for the actionName attribute deletes one or more children of the target component that have been added to the <graph> with a <callAction>.


Attribute Example: actionName=“submitAnswer”

The submitAnswer specification for the actionName attribute triggers automatic submission of the target <answer> when the condition for the <callAction> is satisfied.


Attribute Example: actionName=“startAnimation”

The startAnimation specification for the actionName attribute acts on a target <animateFromSequence/> component.


Attribute Example: actionName=“stopAnimation”

The stopAnimation specification for the actionName attribute acts on a target <animateFromSequence/> component.


Attribute Example: actionName=“toggleAnimation”

The toggleAnimation specification for the actionName attribute acts on a target <animateFromSequence/> component.


Attribute Example: actionName=“playVideo”

The playVideo specification for the actionName attribute acts on a target <video/> component.


Attribute Example: actionName=“pauseVideo”

The pauseVideo specification for the actionName attribute acts on a target <video/> component.


Attribute Example: actionName=“navigateToTarget”

The navigateToTarget specification for the actionName attribute acts on a target <ref/> component. The user is automatically taken to the referenced link when the condition for the <callAction> becomes true.


Attribute Example: actionName=“copyDoenetMLToClipboard”

The copyDoenetMLToClipboard specification for the actionName attribute acts on a target sectional component.


Attribute Example: triggerWhen

The triggerWhen attribute takes a boolean condition that triggers the action to occur when the condition is true.

Note that this process is repeated each time the boolean is newly true. To observe this behavior, drag the point back and forth into the negative xx region several times. Also, move the blue <point> child each time so that you can clearly see the new <point> child that appears.


Attribute Example: triggerWith

The triggerWith attribute references a named <callAction>, <updateValue>, <triggerSet>, <booleanInput>, or an <answer>.

When the user perfoms any interaction with the referenced component (including submitting an incorrect answer or unchecking a checkbox), the <callAction> is performed.


Attribute Example: triggerWhenObjectsClicked

The triggerWhenObjectsClicked attribute takes a component reference as input. Any graphical component that can be clicked can serve as a trigger.