# Problemo applying drag to Display Object with nested components

**URL:** <https://forum.kirupa.com/t/problemo-applying-drag-to-display-object-with-nested-components/289152>\
**Category:** flash\
**Created:** [May 26, 2009, 11:39pm UTC](https://forum.kirupa.com/t/problemo-applying-drag-to-display-object-with-nested-components/289152 "2009-05-26T23:39:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohbeewan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ohbeewan/32/1745_2.png) [@ohbeewan](https://forum.kirupa.com/u/ohbeewan)\
**Post date:** [May 26, 2009, 11:39pm UTC](https://forum.kirupa.com/t/problemo-applying-drag-to-display-object-with-nested-components/289152/1 "2009-05-26T23:39:14Z")

</div>

I have a display object, and I want to allow users to drag this display object about the screen - no big deal.

Complicating the issue is that, nested in the display object, I have components, and I need their mouse enabled properties to stay true so users can select the items in the components and not drag while doing so.

Normally, in the handler called by a MOUSE\_DOWN event, wherein you would apply the startdrag() function to the target of your event, you could apply the startdrag method to the currentTarget, like so:

```auto

private static function _dragObj(e:MouseEvent):void
{
     e.currentTarget.startDrag();
}

```

…And this would kill any nested children from being individually dragged, grouping all to be dragged along in the parent display object.

BUT…what if one of your children is a ScrollPane, and you want to allow dragging on the scrollbar without dragging the parent display object? Checking the scrollbar against its super class, I had to do this:

```auto

if (e.target is LabelButton)
{
    //trace("Scroll, don't drag...");
}
else
{
    e.currentTarget.startDrag();
}

```

I’m not sure if this is the best implementation of this; if anyone else cares to comment, I’d appreciate it! But for anyone who might find themeselves with this problemo, this is one solution…

Thanks!
