mardi 27 septembre 2016

Detect what variable is being changed AS3

I am not currently working on a project, but I wanted to know this: Can you detect what variable you are changing, and use it to change the variable?

This is a test project I made

var code:String="hello there; hi human"
var parts:Array = code.split(";");
parts[0] = parts[0].split(" ")
parts[1] = parts[1].split(" ")
trace(parts[0] [1])

But could I, instead of this part:

parts[0] = parts[0].split(" ")
parts[1] = parts[1].split(" ")

add something to make it automatically put parts[correctnumber] for each one?

For example, could I make it so testvar[x] = testvar[x] with the x being any number?

If I am not clear, tell me.

Aucun commentaire:

Enregistrer un commentaire