StartDrag targetting problem, Flash MX

  • timjerram
  • Born
  • Born
  • timjerram
  • Posts: 2
  • Loc: London UK

Post 3+ Months Ago

Help needed and gratefully recieved concerning a Flash MX startDrag issue:

Description: The following code is attached to a button nested inside a movie clip on the stage at _root. When the movie runs the user should be able to 'tear off' one or any number of duplicates of the original instance by click-dragging copies away from it. The original instance should stay in place while only the copies are draggable and repositionable.

The Problem: The 'target' argument of the startDrag action never works. Instead of dragging the newly duplicated instance, the startDrag always picks up the original object, not the newly created copy. Everything else works except that the new instance is always left behind while the original is dragged. I've tried changing the eval() argument in the startDrag target to an absolute value, and have that reference an exisiting movie clip on the stage but even that doesn't seem to work. I'm wondering if the problem is with startDrag or if I'm missing something. Any help greatly appreciated.


on (press) {

// If this is the original instance then copy it, give the copy a unique name and start to drag the copy

if (this._name == "V1") {
duplicateMovieClip(_root.V1, "V1"+_root.code.counter, _root.code.counter);
trace("V1"+_root.code.counter);

// the startDrag here is the problem:
startDrag(_root.eval("V1"+_root.code.counter));

i = this._name; // add a watch variable
_root.code.counter++;

} else {

// If its not the original letter don't copy it, just drag it.

startDrag(this);
i = this._name;
this._alpha = 75;
}
}


on (release, releaseOutside) {
this._alpha = 100;
stopDrag();
}

With Thanks, TJ
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • dhonsvick
  • Beginner
  • Beginner
  • dhonsvick
  • Posts: 49

Post 3+ Months Ago

try when you duplicate the movieClip assigning the result to a variable

var dubby_clip:MovieClip = duplicateMovieClip(_root.V1, "V1"+_root.code.counter, _root.code.counter);

then start your drag on the variable name

startDrag(dubby_clip);

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 22 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.