<Array frequency="" indexFlag="" >
<Text textExp="" size="" align="" x="" y="" color="" />
</Array> Parameter | Type | Mandatory | Description |
|---|---|---|---|
indexFlag | String | Yes | Index name, which can be referenced in elements below. |
frequency | Expression | Yes | Number of times that an element is repeatedly generated. |
In the XML specifications, a text view is generated. Its content and position (x and y coordinates) are determined based on the index.
The value of indexFlag starts from 0 and ends with the value of frequency minus 1. The value of #__i indicates the current value in the loop.
Example 1: An element array can be adjusted together with variables and cycle commands.
Declare the array variable find whose size is 100, but do not assign initial values. In addition, set const to true, indicating that a variable can be assigned only one value. In this case, the element array cyclically generates 100 different text views, where the values of textExp, x, and y are calculated based on expressions and the current number of loop times. Currently, no element is displayed because no initial value is assigned for find. After the button is pressed, the cycle command cyclically assigns values to the find[index] variable and informs the response text view to update the value to the latest one.
<Var name="find" type="number[]" size="100" const="true" />
<Array x="100" y="300" frequency="100" indexFlag="__i" >
<Text textExp="#find[#__i]" size="30" align="center" x="#__i%10*90" y="int(#__i/10)*90" color="#ffffff" />
</Array>
<Button x="0" y="0" w="1080" h="1920">
<Trigger action="up">
<CycleCommand frequency="100" indexFlag="col">
<VariableCommand name="find" type="number[]" index="#col" expression="#col" />
</CycleCommand>
</Trigger>
</Button>