Using sensor reading in Array

Hello, I’m new to actionscript and this forum so sorry in advance if my posting doesn’t belong here

I’m using arduino and nada to communicate to a flex sensor. Depending on the output of the flex sensor I want to to play certain movie clips in my flash.

For example: when someone bends flex sensor , out put is put into a formula and reads ( 4 )… how do we use the reading ( 4 ) to play movie clip ( 4 )

heres my code
thanks in advance

nadaComponent.addEventListener(“isReady”, function(evt:Object) {


this.addEventListener(“parameterChange”, function(evt:Object) {

if (evt.paramName == “arduinosms1.analogin1”) {
_root.label0.text = _nada.arduinosms1.analogin0; // flex sensor reading in text box

num = Math.round((0.05) * (label0.text)); //convert flex output to amount of movies that will be played

label1.text = num; //amount of movies(figure#) to be played

var figure = [“figure0”, “figure1”, “figure2”, “figure3”, “figure4”, “figure5”];

for( i = 0; i < num; i++) { //here’s where im having trouble

  • }*

  • }*

  • });*