actionscript 3 - Flex titledborderbox drag and drop disable dragging children of titledborderbox -
so have titledborderbox in flex 4 custom skin, working on drag , drop application , have run problems.
when initiate drag , drop on component able drag it's children not titledborderbox itself, example: can grab label, or button inside box , can start dragging not desired functionality. should able click anywhere on titledborderbox , drag whole component it's children new position. have tried mousechildren = false disables events on children not of children buttons have able interact anyway. there workaround problem, how solved?
my titledborderbox containers in hgroup, able drop titledborderbox @ specific position, example: if have 4 titledborderbox containers , start dragging last 1 able place @ position 1 in hgroup container drag manager places dropped item last item in group, there solution that?
i have use layout , can't change other layout, can't find decent example of trying achieve, possible? appreciated, thank you. here code dragging:
private function handlestartdrag( evt:mouseevent ):void { // grab item renderer , relevant data var dragitem:iuicomponent = evt.target iuicomponent; var dragsource:dragsource = new dragsource(); dragsource.adddata( dragitem, "item" ); dragmanager.dodrag( dragitem, dragsource, evt ); this.buttonmode = true; } protected function handledragenter( evt:dragevent ):void { if( evt.dragsource.hasformat( "item" ) ) dragmanager.acceptdragdrop( evt.target iuicomponent ); } protected function handledragdrop( evt:dragevent ):void { var dragitem:object = evt.dragsource.dataforformat( "item" ); var dragitemowner:group = ( dragitem.owner group ); dragitemowner.removeelement( dragitem ivisualelement ); var targetowner:group = ( evt.target group ); targetowner.addelement( dragitem ivisualelement ); }
try changing
dragmanager.acceptdragdrop( evt.target iuicomponent ); to
dragmanager.acceptdragdrop( evt.currenttarget iuicomponent ); event.target reference object "caused" event (maybe image or textfield within box). event.currenttarget reference object binds event listener (your box).
another option set mousechildren-property of box false not fire mouseevents. useful if children should never fire mouseevent.
Comments
Post a Comment