mardi 21 février 2017

Accessing Items in an Array - AS3

I've got item.movieimage = one, three, sixteen, fourteen; (where item is an object (item:Object) )

The words changes as the code is taking them from my database. The database changes the words every week.

Now, I want my AS3 code to display the third element of item.movieimage.

I've tried to do this :

var my_str:String = item.movieimage+",";
var ary:Array = my_str.split(",");
    trace(ary[2]);

But it's not working. The output is "undefined".

Do you know how can I access a specific item in the Array that I've created ? Or how can I access the third item of item.movieimage ?

If I do trace(ary);, the output is :

one, 
three, 
sixteen, 
fourteen,

Aucun commentaire:

Enregistrer un commentaire