StartDrag targetting problem, Flash MX

  • timjerram
  • Born
  • Born
  • No Avatar
  • Joined: May 28, 2007
  • Posts: 2
  • Loc: London UK
  • Status: Offline

Post May 28th, 2007, 12:35 pm

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
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 28th, 2007, 12:35 pm

  • dhonsvick
  • Beginner
  • Beginner
  • No Avatar
  • Joined: May 27, 2007
  • Posts: 49
  • Status: Offline

Post May 28th, 2007, 3:29 pm

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 54 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
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.