> > > > It seems you're being unnecessarily complicated here. Why take > the pieces, > > move piece A, remove piece A from the group and then move all the rest? > > I'd > > do it all in one loop. > > > I thought I needed that approach because how would the group know > what piece > is being moved and how would the other pieces in the group know which to > move from? If I just tell the group to move according to current mouse > location, all the pieces in the group will position itself to the mouse > coordinates, not by where it should be located by the moved piece.. If you > have a better solution, I'm happy to hear from you :)
There are a lot of methods that will work. For eacmple, on mouseDown you can do this: pLastMouseX = _xmouse pLastMouseY = _ymouse Then on each enterFrame, do this: var tX = _xmouse var tY = _ymouse var tOffsetX = tX - pLastMouseX var tOffsetY = tY - pLastMouseY pLastMouseX = tX pLastMouseY = tY and apply these offset values to each movieclip in the group list: mc._x += tOffsetX mc._y += tOffsetY Then you're guaranteed to move all clips by the same distance each time. Which particular clip has actually been clicked on is pretty irrelevant, really. > > As for the source of your problem, I'm guessing it's > > because the mouse moves while the loop is running. Try storing > the _xmouse > > and _ymouse properties at the start of the loop. > > > > within or before the onEnterFrame event? If before, how would I tell the > group the current position I want them to be? I mean, I think > it's obvious I > need to loop _xmouse & _ymouse properties, right? If within, > wouldn't it be > too redundant to store _xmouse + _ymouse properties into a variable before > processing it? No, not at all. If the mouse is moving while the code is running (which it will be), then it's more than possible that the value of _xmouse will vary from one iteration of the loop to the next, leading to errors. To ensure consistency, it's essential to store the values in a temporary variable. Danny _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

