A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Simple Array & List Question

  1. #1
    -
    Join Date
    Feb 2006
    Posts
    74

    Simple Array & List Question

    Array

    If i have an array called

    myLayerArray = new Array();

    1) How can I clear all data in it?
    2) How can I clear last item added?

    List Component
    If i select an item in a list how can i pull the data attached to that item with a button

  2. #2
    Custom User Title
    Join Date
    Jul 2005
    Location
    TN
    Posts
    45
    Off the top of my head, to clear all the data you could just redeclare the array:
    Code:
    myLayerArray = new Array();
    And to clear the last item added:
    Code:
    myLayerArray[myLayerArray.length - 1] = null;

  3. #3
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    myLayerArray.length = 0; // to empty the array

    myLayerArray.pop(); // to remove the last element
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center