A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Lots of MCs, lots of frustration!

Hybrid View

  1. #1
    Member luffmcgruff's Avatar
    Join Date
    May 2002
    Posts
    90

    Lots of MCs, lots of frustration!

    I'm writing a small simulation that's dealing with a large number of small MCs that are dynamically created.

    I also need to run a hitTest that checks whether any clip is in contact with any other clip.

    code:
    function Hitdetect() {
    for(i=0; i<=100; i++) {
    if(this.hitdetectMC.hitTest(_root["character"+i])) {
    proximity ++;
    }
    }
    }



    proximity is a variable inside each instance of the character MC.

    The problem I have is that I need to create another function, Spawn, that creates another instance of the original character MC. The problem is, I don't know the best way to assign a name and depth to the newly created MC considering that some of the MCs will be deleted based on their own code.

    Can someone suggest a way of storing the identity of the created movie clips?

    I considered using an array to store the IDs of the instances, but everytime a new clip is created, the array will end up getting bigger and bigger, and the scanning of that array will end up slowing the whole processing down.

  2. #2
    Qwaizang:syntax_entity_ Q__Hybrid's Avatar
    Join Date
    Aug 2005
    Posts
    270
    I'm confused. Is a new clip created when two clips touch (hitTest)? Is an existing clip deleted when two clips touch? Are there more than 100 clips in total or is this the maximum allowed?

    More details, please.
    +Q__

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