Events to Change Textures
- SetTexture – A String when used as a TouchEvent or Dictionary when used as a non-Touch Event. See both examples below….
- SetTextureSafely – same as above but will stop all actions on the Element (this is needed if the Element is animating textures)
- SetTextureFromPool – A String when used as a TouchEvent or Dictionary when used as a non-Touch Event. As a String the value will be the Pool name. The Element will cycle through the textures in the pool starting with the first. When used as a Dictionary key (see below) each key will be the Element to change texture, and the value will be the Pool Name.
- SetRandomTextureFromPool – You can randomize a texture by setting the value of pool. The pool should contain the names of possible textures to use. For example, Cloud1, Cloud2, etc.
- SetTextureFromPreference – The value should be equal to another value you set earlier (for example, using the SetValues dictionary or SetValuesIfNil dictionary). Essentially this is just an in-between reference to the texture. But like any variable, it can change over time. So the user might tap a button to change the value, then change the texture from the preference.
You could also do something like…..
Because SetValuesFromPool (and all SetValue-related code is run first), the event cycles through a new value from the pool, then uses that value for the texture. This would be a great way to cycle through things like clothing choices for a character in your book.