A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: duplication level

  1. #1
    Sinner
    Join Date
    Jan 2001
    Location
    Preston
    Posts
    89

    duplication level

    Hi everyone,
    ok im having some trouble with a movie that im making.Ok i have a global variable called"N" set to 70.
    i have a movie clip on the main stage called "Ninja" and on this ninja movie clip i have the following code:
    code:
     onClipEvent (enterFrame) {
    if(this.hitTest(_root["mc"+90])){
    this.gotoAndStop(75);
    _root["mc"+90].gotoAndStop(21);
    if (N>=70 && N<=89) {
    duplicateMovieClip(_root.Ninja, "NMC"+N, N);
    N++;
    }else {N = 70;}
    }
    }


    so i want every time the movie clip is hit to duplicate its self between the levels 70 - 89 so there will never be more than 19 instances on screen. i know the hit part works because it is sending the ninja movie to frame 75 as stated. However it is duplicating the movie always to layer 70 and not incrementing thus deleting the original movie on layer 70 so there is only one instance appearing at a time.

    also when debugging i get the following results:
    Movie Clip: Frame=10 Target="_level0.NMC70.instance33"
    Movie Clip: Frame=10 Target="_level0.NMC70.instance34"
    so its copying the instance but not assigning a new level

    any help would be absolutly great as i havent got much hair left on my poor balding head.

    P.S. using MX
    Last edited by Overfiend; 06-10-2004 at 06:58 PM.
    Ž„‚É‚Í‚¨Žð‚ðˆù‚ވȊO‚ÉŠy‚µ‚Ý‚Å‚·B(My only pleasure in life is drinking)

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    When you duplicate the movie the code is also duplicated, doing the same thing all over again for every copy.

    You have to make it work only for your original movieclip. Something like asking...

    if(this.hitTest(_root["mc"+90]) && this._name=="Ninja"){

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Sinner
    Join Date
    Jan 2001
    Location
    Preston
    Posts
    89
    Thanks for the reply,
    but i need the new movie clip also to duplicate itself if it becomes hit with the ["Mc"+90] but if i add your code would that just make the mc 90 only affect the original ninja mc?
    Ž„‚É‚Í‚¨Žð‚ðˆù‚ވȊO‚ÉŠy‚µ‚Ý‚Å‚·B(My only pleasure in life is drinking)

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Sorry I misread your code.

    I see that there are no quotes around Ninja in....

    duplicateMovieClip(_root.Ninja

    ..but maybe that works anyway.


    I guess you have declared the global variable somewhere else in the movie too.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Sinner
    Join Date
    Jan 2001
    Location
    Preston
    Posts
    89
    Yeah it works without quotation marks. the global variable is on the main time line with another for the level of the clip its doing the hit test against
    Ž„‚É‚Í‚¨Žð‚ðˆù‚ވȊO‚ÉŠy‚µ‚Ý‚Å‚·B(My only pleasure in life is drinking)

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I dont know really wahts going wrong then. Have you tried making a normal variable of N ( setting it on the _root ) to see if its there the problem lies.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

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