all groups > flash actionscript > july 2004 >
You're in the

flash actionscript

group:

Duplicate and drag promblems! - goldencream.fla (0/1)


Duplicate and drag promblems! - goldencream.fla (0/1) Sunil
7/28/2004 10:14:39 PM
flash actionscript:
Hello,

I have got a MC (called "a") that consists of a button and a picture.
The button's actions are:


on (press) {
if (this._name == "a") {
newname = "a"+_root.name;
duplicateMovieClip (_root.a, newname, _root.name);
startDrag (newname);
_root.name++;
} else {
startDrag (this);
}
}



on (release) {
stopDrag ();
}

However, when I press movieclip "a" it duplicates it, but doesn't
start dragging it...

View attachment for FLA

Thanks,
Re: Duplicate and drag promblems! - goldencream.fla (0/1) mandingo
7/30/2004 4:25:42 AM
Here, this will get it to drag straight away from the duplicate event... but
will then introduce a new problem... the onRelease won't work because you never
actually started the .startDrag() by clicking on this movieClip... but maybe
you can work something out from here

try :

on (press) {
if (this._name == "a") {
newname = "a"+_root.name;
duplicateMovieClip(this, newname, _root.name);
_root.name++;
this._parent[newname].startDrag();
} else {
this.startDrag();
}
}
on (release) {
stopDrag();
}


cheers,
AddThis Social Bookmark Button