A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: array of Movie Clips 2

  1. #1
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476

    array of Movie Clips 2

    I already asked this question, but I thought I'd simplify what I'm asking. If I've got an array that contains mc names like this:
    PHP Code:
    var homeArray = new Array("home1_mc",
                        
    "home2_mc",
                        
    "home3_mc",
                        
    "home4_mc",
                        
    "home5_mc",
                        
    "home6_mc",
                        
    "home7_mc",
                        
    "home8_mc"); 
    How do I do the equivalent of this:
    PHP Code:
    var i:MovieClip homeArray[0];
    var 
    image1:MovieClip addChild(new i); 

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You have all sorts of type misunderstandings above. There's really NO reason to put Strings in your array. I think what you really want in your array is Classes. So, if you have these clips in your library, export them for actionscript with appropriate class names (which differ from instance names). Then you can do this:
    Code:
    var homeArray = [Home1, Home2, Home3, Home4, Home5, Home6, Home7, Home8];
    
    var homeClass:Class = homeArray[0];
    var image1:MovieClip = addChild(new homeClass());

  3. #3
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476
    Thank you, I finally got it working!

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