PDA

View Full Version : all dragable but one; why?


rfl
03-30-2002, 11:52 PM
i have a mc that is dragable; i also have a button that sends the playhead to frame 2 where it randomly duplicates the mc; when the duplication is performed, all the "clones" are dragable except one; why?
the mc code is:
----------------------------------------
onClipEvent (load) {
this._x = random(300);
this._y = random(300);
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.startDrag(false);
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.stopDrag(false);
}
}
-------------------------------------------
the frame code is:
-------------------------------------------
amount = random(10);
trace(amount);
while(amount>0) {
duplicateMovieClip (ca, "ca"+i, i);//ca is the instance name of the mc
i = i + 1;
amount = amount-1;
}
------------------------------------------

farafiro
03-31-2002, 08:21 AM
Seems that everythins is ok, so try to post the fla here.

But there is some notices here (in red)


onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.startDrag(false); //this should b true
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.stopDrag(false); stopDrag doesn't need the "false"
}
}

rfl
03-31-2002, 11:08 AM
apart from that, someone came with this - and it really works:
-------------
amount = Math.ceil(Math.random()*10);
for (i=0;i<amount;i++){
ca.duplicateMovieClip ("ca"+i, i);
}
-------------

farafiro
03-31-2002, 11:16 AM
and what would that do to your problem??

rfl
03-31-2002, 11:19 AM
remeber the title of my post?
Now, ALL the mc's are dragable!