Search Tutorials
The createTextField methodThe drawFields function dynamically creates input fields for the user with the createTextField method of movieclips. We are using this method to create fields for both the chart labels and the chart data. The createTextField method takes the following parameters:
For example, the following code creates an instance of the TextField object on the main
timeline called ChartLabel and fills it with the text Enter Chart Label.
createTextField("ChartLabel",1,50,100,120,20);
In our case, we want to assign a dynamic instance name for each of the
text fields - ChartLabel1, ChartLabel2 and so on. We add the looping variable
i onto the field name ChartLabel. The depth and y value must also be dynamic
otherwise the fields would stack on top of each other.
So our code looks like:
this.createTextField("ChartLabel"+i,i,410,90+(i*25),85,20);
We can then add some text with this["ChartLabel"+i].text = "Enter Chart Label";
And make the TextField object into an input box so users can enter text. this["ChartLabel"+i].type = "input";
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|