Skip to main content
Participating Frequently
August 4, 2008
Question

Drag attachMovie clips

  • August 4, 2008
  • 5 replies
  • 527 views
I have buttons that use attachMovie to dynamically load clips onto the stage. I would like the user to be able to click and drag the loaded clips within a limited area.

How do I make the attached Movies 'draggable'? Here is the code I am using to attach the movies

function areaButton(locatorClip):Void {
attachMovie(locatorClip,"MyClip",10,{_x:300, _y:300});
}

button1.onRelease = function() {
areaButton("movieClip01");
};

button2.onRelease = function() {
areaButton("movieClip02");
};

button3.onRelease = function() {
areaButton("movieClip03");
};

----
this is my code for start and stopDrag, but it doesn't work

MyClip.onPress = function():Void {
this.startDrag(false,200,100,400,200);
};

MyClip.onRelease = function():Void {
this.stopDrag();
};

Any help would be much appreciated!

Kristen
This topic has been closed for replies.

5 replies

kglad
Community Expert
Community Expert
August 5, 2008
you're welcome.
SknygrydgAuthor
Participating Frequently
August 5, 2008
I understand. Simple enough.

Again, thank you for taking the time to answer my questions.

Cheers!

Kristen
SknygrydgAuthor
Participating Frequently
August 5, 2008
This code works perfectly! Thank you kglad.

Would it be possible to get a quick explanation as to how this works?

I'm assuming that it has something to do with the 'dep' - what is this code and what is it doing to my attached movies to make the start and stop drag work?

Again, thank you so much kglad!
kglad
Community Expert
Community Expert
August 5, 2008
you're welcome:

kglad
Community Expert
Community Expert
August 4, 2008
:

SknygrydgAuthor
Participating Frequently
August 4, 2008
sorry about the double post