A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Duplicate Movie Clip Issue

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    Duplicate Movie Clip Issue

    i have a movie clip that fades it's alpha out to 0 after a set amount of time, then duplicates it's self.

    the problem is, when it duplicates it's self the alpha is still set to 0, so you can't see it.

    i have tried using setproperty on the duplicate, so right after it duplicates, the alpha gets set to 100 again, but this didn't work.

    any ideas?

  2. #2
    Keeper of Brooms and Jars
    Join Date
    Oct 2001
    Posts
    456
    after you duplicate the clip, reference the new clip by its name.
    code:

    //from a function called by the fading clip or inside the fading clip itself
    this.duplicateMovieClip("newName", newLevel);
    newName._alpha=100;



    there are plenty of ways you can do this, just fool around until you find a way to reference the new movieclip.
    *smiles, waves*

  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    160

    re:

    ok i got that working, but i figured it out before you posted

    now the issue is getting the duplicate movie clip to fade out, right now i got it to disappear form the screen using removemovie clip based on an _x array position, but what i'm trying to do is get it to fade out in alpha then delete itself.

    any ideas?

    thanks for the help!

  4. #4
    Keeper of Brooms and Jars
    Join Date
    Oct 2001
    Posts
    456
    make a class. ill whip an example together in a few minutes
    *smiles, waves*

  5. #5
    Keeper of Brooms and Jars
    Join Date
    Oct 2001
    Posts
    456
    code:

    //Fade class
    Fade = function(){
    this.constructor.num++;
    this.num=this.constructor.num;
    }

    //fade, dupe, and delete
    Fade.prototype.onEnterFrame=function(){
    this._alpha*=.7;
    if(this._alpha<10){
    temp=attachMovie("circ", "tempName", this.num+1);
    trace(temp.num);
    temp._name="fade"+temp.num;
    temp._x=this._x+10;
    temp._y=this._y+20;
    unloadMovie(this);
    }
    }

    //allows the attachMovie function to be used, allowing dynamic attachment of clips in the library
    Object.registerClass("circ", Fade);

    attachMovie("circ", "fade1", 1);



    sorry i gotta run, no time to explain it all... eesh, struggle through it if you can and read this tute
    http://www.debreuil.com/docs/ch01_Intro.htm

    PS ill get on later and go into a little with you
    *smiles, waves*

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