Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:02:11+00:00 2026-05-23T10:02:11+00:00

I have an array I am using to hold movie clips, and I’d like

  • 0

I have an array I am using to hold movie clips, and I’d like to be able to change all of them at once using the array. Now, I can do it using array[0,1,2,3,4,5,6,7,8...].changestuff but with 60 or so movieclips, it gets unwieldy. Is there a simpler way to go through the entire array and apply the changes to each movieclip stored within?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:02:12+00:00Added an answer on May 23, 2026 at 10:02 am

    If you have an array of MovieClips something like this:

    var a:Array = new Array;
    for ( var j:int = 0; j < 10; j++ )
        a[j] = new MovieClip;
    

    You have 3 ways of looping through it and affecting all the MovieClips inside it. The first is the basic for loop:

    var len:int = a.length;
    for ( var i:int = 0; i < len; i++ )
    {
        var mc:MovieClip = a[i];
        trace( mc );
    }
    

    The basic for loop is the quickest way of looping through an array. You just need to find the MovieClip at the specific index using the brackets operator. a[i] will return the MovieClip at the current index (e.g. a[0] will return the MovieClip at the start of the array, a[1] the next one, etc).

    You can also do a for..each:

    for each( var mc:MovieClip in a )
        trace( mc );
    

    For..each loops are slightly slower than a normal for loop, but has the added benefit of having access to the object directly, already casted. It can be quite convenient

    And finally use the forEach() method:

    a.forEach( this._loopFunc );
    
    private function _loopFunc( mc:MovieClip, index:int, a:Array ):void
    {
        trace( mc + " is at index " + index + " in array " + a );
    }
    

    I’ve never really seen forEach() used anywhere, but you might find it useful. For the callback, you need to declare 3 parameters, the object, the index, and the array itself.

    You can find more info at the Array documentation: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array that I would like to sort using a date field
I have a JSON array with ActiveRecord objects. These objects can be reconstructed using
Hey right now I'm using jQuery and I have some global variables to hold
I need to create an array of arrays. I have been using array_map(null,$a,$b,$c) to
I am using PHP and I have an array of user images that I
I have an array of countries that I will be using in a select
I have a char array buffer that I am using to store characters that
I have an associative array that I want to display using TileList. However, it
I have an IEnumerable<DirectoryInfo> that I want to filter down using an array of
Using explode i have converted the string into array , But the array look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.