• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Arrays > Changing Elements in Arrays

Changing Elements in Arrays

Now that you know how to add and remove elements, let's discuss how to change them. We will create an array, trace it to see the original, change the first element to something else by using the index, and then trace it again to see the difference as shown in the following code:

var my_array:Array = new Array("fName","lName");
trace(my_array);
my_array [0] = "age";
trace(my_array);
//output: fName, lName
//        age, lName


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint