Reputation: 1
I have a problem with the startDrag function I'm using in AS3. Right now I have a movie clip which is made up of 4 different layers. I export the movie clip, create and object of it, add in an event listener for mouse clicks that calls the startDrag function. However, instead of dragging the entire Movie Clip and all of its parts, it only grabs and drags one layer around, which breaks the different parts of the Movie Clip up.
public function HopperMouseDown(event:MouseEvent):void
{
event.target.startDrag(true); //start dragging tile
// mSoundManager.PlayTileUp(); //play tile up sfx
}
This is my function for the MouseClick event on the MovieClip. I initiate the startDrag event, but here it will not drag the entire Move Clip for some reason it only drags the different pieces inside the clip. Any help is appreciated.
Upvotes: 0
Views: 1048
Reputation: 1440
The most simple and basic answer would probably be that you need to apply the startDrag() function to an object. Since you want this for all objects/layers, I'd suggest you use
//applies the startDrag method to everything that's on the stage
stage.startDrag();
or
//applies the startDrag method to everything within the class you're working in
//(or maybe in few cases the parent function, I'm not completely sure)
this.startDrag();
be sure to try them both. These two may or may not have different results, depending on your objects and code.
Upvotes: 0