Skip to main content
Kanny_N
Participant
June 3, 2009
Question

DuplicateMovieClip&StartDrag

  • June 3, 2009
  • 1 reply
  • 625 views

How can I drag a duplicated Movie Clip from DuplicateMovieClip Function? ( use one movie clip)

Example below:

on(press) {
duplicateMovieClip("_root.a1","a2", 2);
setProperty("a2", _xscale,100);
setProperty("a2", _yscale,100);
}

on (release) {
  startDrag("a2",true);
}

It does dupllicat the Movie Clip but I can't drag the duplicate.  I learned this from a very old Flash lesson.  I wonder there is a new way to write it now.

How do you define the depth in this function?

Thx

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 3, 2009

if you want to duplicate the clicked movieclip:

yourMC.onPress=function(){
if(!this.depth){
this.depth=1;
} else {
this.depth++;
}
var mc:MovieClip = this.duplicateMovieClip("mc",this.depth);
mc._x = this._x;
mc._y = this._y;
mc.startDrag();
}

yourMC.onRelease = yourMC.onReleaseOutside = function(){
mc.stopDrag();
}

Kanny_N
Kanny_NAuthor
Participant
June 7, 2009

Hey Kglad,

Thank you so much for your information.

It did work by using part of your script.

Cool, I can go to bed early today now 

I am new to this ActionScript, so I will be back to ask strange question.

kglad
Community Expert
Community Expert
June 7, 2009

you're welcome.