SparkRef

Syntax

[var name] = sparkref(โ€œ[spark instance name]โ€)

Return: ValMap in the โ€œSparkโ€ format

Description

PLEASE NOTE: This is currently a MEMORY HEAVY API, so use it wisely.

Used for cases where a Spark Instance needs to be modified many times within the same script. This could be multiple traits on the same instance or the same traits modified multiple times (as in the case of a for or while loop).

Sample Usage

Adjust the altitude and position traits of a spark called "Spark 1"

spark =  sparkref("Spark 1")
spark.traits.altitude = 3
spark.traits.position.value = "(0,1)" 

Changing the Background Color of a Button Using Both RGBA and Hex Formats

button  =  sparkref("Button")
print button.traits.backgroundColor.value
button.traits.backgroundColor.value = "(0.5,0,0,0.5)"
button.traits.backgroundColor.value = "#FF0000FF"

Adding Bullet Points in Text Using Unicode Hex Values โ€œ\u2022โ€ in Ember Script

content = sparkref("Text")
content.traits.text.value = "\u2022Hello World"

Last updated

Was this helpful?