3 Replies - 1574 Views - Last Post: 18 February 2009 - 10:29 AM

#1 Goobicon  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 23
  • Joined: 16-February 09

Move several MovieClips around another when the mouse is clicked and d

Posted 17 February 2009 - 12:33 PM

Unfortunately, some jerk at work ganked my flash drive so I have no code, but I'm hoping someone can point me in the general direction of how to make things work.

Basically, I have a circular movieclip, with an array of movieclips arranged in a circle around it. In other words, a circle, with eight circles arranged in a circular pattern around it. I'm wanting to make it so that when the user clicks one of the buttons (or maybe another mc) that the outer clips rotate around the inner one based on the direction the mouse goes. The circular movement wasn't the hard part, I just couldn't figure out how to implement the click and drag.

Failed to mention: I was trying to do this in AS3. I am aware of event handlers and how they work, I just couldn't seem to get a click and drag to work. And then there's the matter of moving the clips in the same direction as the mouse that I think I can get but some suggestions might help.

Again, I apologize I have no code but it's all on my flash drive or my non-internet enabled computer at home.

Is This A Good Question/Topic? 0
  • +

Replies To: Move several MovieClips around another when the mouse is clicked and d

#2 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

Re: Move several MovieClips around another when the mouse is clicked and d

Posted 17 February 2009 - 05:31 PM

Drag & Drop ain't too much more than this:
mc.addEventListener(MouseEvent.MOUSE_DOWN, startDragHandler);
mc.addEventListener(MouseEvent.MOUSE_UP, stopDragHandler);

function startDragHandler(event:MouseEvent):void
{
	event.target.startDrag();
}

function stopDragHandler(event:MouseEvent):void
{
	event.target.stopDrag();
}


Read more about startDrag()'s optional parameters here.

Hope this helps..

This post has been edited by skater_00: 17 February 2009 - 05:40 PM

Was This Post Helpful? 1

#3 Goobicon  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 23
  • Joined: 16-February 09

Re: Move several MovieClips around another when the mouse is clicked and d

Posted 18 February 2009 - 10:26 AM

Awesome, yeah it does give me something more to go on. Although...this is specific to the one Sprite or MovieClip, isn't it? That means I've got to wrap my head around how to rotate them all when one calls the startDrag() method. But this is definitely better than what I could figure out. Thanks!

edit: I noticed the documentation is for a Sprite() object, is startDrag() inherited from MovieClip? If not it'll just mean I have to animate things with code instead of with the time line...not too big a deal.

This post has been edited by Goobicon: 18 February 2009 - 10:29 AM

Was This Post Helpful? 0
  • +
  • -

#4 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

Re: Move several MovieClips around another when the mouse is clicked and d

Posted 18 February 2009 - 10:29 AM

View PostGoobicon, on 18 Feb, 2009 - 06:26 PM, said:

Although...this is specific to the one Sprite or MovieClip, isn't it? That means I've got to wrap my head around how to rotate them all when one calls the startDrag() method.


You can also add the event listeners to your array of movieclips, if you want all of 'em to be draggable.

This post has been edited by skater_00: 18 February 2009 - 10:39 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1