Controlling SKActions from the Property List – Story Tellers iOS Starter Kit Documentation

Event Properties for timeline based SKActions (composed from Action files)

Story Tellers iOS Starter Kit 2 Documentation

This article shows how to run or stop SKActions which have been composed and then saved as references via the Scene editor’s new timeline in Xcode 7. As of Build 1.07 we are offering an alternative way to run and compose SKActions via the property list (which also has some neat advantages).  To read about our alternative method, go here.


Actions are typically triggered to run (or stop) from an event. This could be ANY event, TouchEvent, TouchUpEvent, or ANY of the other various ways to call events. There’s plenty…

  • RunAction – This is usually setup as a dictionary with RunAction as the name. The action name is the key, and the node to run the action is the value. For example…

Screen Shot 2015-09-22 at 10.26.18 PM

If you wanted multiple nodes to run the same action, they could by changing the type to an array and listing each node. For example, Balloon, Balloon2….

Screen Shot 2015-09-22 at 10.26.38 PM

Alternatively if you only want to run the action on the Element touched, you can set it up like the following image…

SKAction example 2

The action will only be applied to itself and no other Elements. This is important if you had multiple Balloon elements onstage, but only wanted to Pop the one touched. Keep this in mind, if you ever generate elements all with the same name.

  • StopAction – The Action name to stop. The Element must be running an action with this name to see any affect. Setup identical to RunAction.
  • RunOrStopAction – The Action name to run or stop. If the action is running it will be stopped, or if it is stopped, it will be run.
  • StopAllActions – All actions on the node(s) will be stopped. This property can be setup as a String type where the value is the node, or as an Array where you list multiple nodes to stop (see the example below).

Stopping SKActions programmably



Actions based on Saved Values (Preferences)

RunActionFromPreference – This allows you to run particular actions based on a user preference. This could be used for any action, but this is mostly intended for use with the AnimateWithTextures action. For example, the user could choose to read the book with a Cat character instead of a Dog character. Throughout every page of the book, you could then run animated frames representing the cat instead of the dog.

As a TouchEvent or TouchUpEvent this setup would look like this (and only run on the Element touched)

Animate with Textures based on saved value

Otherwise the setup would look like this where the key is the saved value (for example, BalloonAnimation) and the value is the Element to run the action on  (for example, Balloon).

Screen Shot 2015-09-28 at 9.56.07 PM

At some point before running this Action you would need to set the value of BalloonAnimation to that of an Action name (assuming you composed an action earlier with that name).  You can set values from events like so…

set values if nil

  • StopActionFromPreference – Stops an action run from a preference name
  • RunOrStopActionFromPreference – Run or stop an action from a preference name. If the action is currently running, it will be stopped and vice versa.


Special Note

As a convenience, you can use RunActionFromPreference in an Elements main dictionary (or Events dictionary). Obviously normal Actions can be run automatically through the Scene editor.

Run SKAction of Animated textures

RunActionFromPreference is an important property for showing an animation that the user has chosen.