A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Duplicated movie will not 'removeMovieClip'

  1. #1
    Calington
    Join Date
    Apr 2006
    Posts
    1

    Duplicated movie will not 'removeMovieClip'

    It's actually the root movie that won't go away. All duplicated 'enemies' explode, but the root character will not die. Here's enemy code:

    onClipEvent(load) {
    this._x-=random(150);
    moveSpeed=random(3)+2;
    }

    onClipEvent(enterFrame) {
    this._x-=moveSpeed;
    if(random(11)==4) {
    this.gotoAndPlay(7);
    }
    }

    and the control that duplicates it:

    for (i=1; i<=3; i++){
    fish.duplicateMovieClip( "fish"+i, i+100 );
    }
    stop();

    Also the game is posted on my site for preview purposes:

    http://calingtondesigns.com/game.htm

    Probably something simple, but it's had me stumped for a long time.

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    removeMovieClip only works on clips created with a depth >= 0,

    since clips created by hand in the flash authoring program are assigned to negative depths in order to remove one of these clips with removeMovieClip you need to first use swapDepths on it,

    fish.swapDepths(9999); // move to a positive depth
    fish.removeMovieClip(); // now it can be removed

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