A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Array of duplicate movieclips

  1. #1
    Member
    Join Date
    Oct 2000
    Posts
    97
    I'm assuming that in principle it is possible to create an array of duplicate movie clips so you can use a loop to acces/change properties of all clips.

    But I can't for the life of me figure out how. Does anyone have an example or a code snippet to help out.

    Information about arrays in Flash 5 seems to be very thin on the ground.

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    movienames=new Array()
    for(i=1;i<=3;++i){
    duplicateMovieClip(_root.movieclipname,"mov"+i,i)
    movienames.push("mov"+i)
    }

    this will produce an array as follows:

    movienames[0]="mov1"
    movienames[1]="mov2"
    movienames[2]="mov3"

    aswell as creating 3 duplicates of a movie!

    you can now change the properties of these movieclips by using:

    _root[movienames[0]]._x=300
    _root[movienames[1]]._alpha=50

    etc..

    Hope that helps!
    Regards FlashGuru



  3. #3
    yosunism grand yosunist
    Join Date
    Jul 2000
    Posts
    72
    whoa.. interesting... how would this be applied to a swf? like a swf banner rotater within a swf?

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    124

    Question for FlashGuru

    FlashGuru,

    Thanks for the info, I needed this today..

    However, this seems like a workaround for a problem with Flash 5's action scripting language.

    Why can't you just directly assign the movie clip reference to an element of an array instead of having to simulate an array and then create the array from those results?

    Please Advise,

    Generator

  5. #5
    Junior Member
    Join Date
    Oct 2000
    Posts
    26

    Re: Question for FlashGuru

    Why can't you just directly assign the movie clip reference to an element of an array instead of having to simulate an array and then create the array from those results?
    Not sure what you mean, Flash Guru created a new array object in his first line with new Array(); Flash 5 doesn't need to simultate arrays anymore especially with actionscript's new array[indice] notation.

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