1

I just made my itemrenderer (which is in a viewstack) draggable, but now I have the following problem, namely I can drag EVERYTHING in my viewstack. I only want to drag the whole itemrenderer or a part of it (cover). At this moment I can also drag the whole navigatorcontent and the scrollbar (!). Does somebody has a solution for my problem? thx in advance!

(example of the faults and the way it has to be --> http://d.pr/i/hjti )

<fx:Script>
    <![CDATA[
        // imports
        import mx.collections.ArrayCollection;
        import mx.controls.Alert;
        import mx.controls.Alert;
        import mx.core.DragSource;
        import mx.managers.DragManager;
        import mx.events.DragEvent;
        [Bindable]
        private var quantity : int = 0;
        private function initiateDrag(event:MouseEvent):void {
            var dragInitiator:List = event.currentTarget as List;
            var source:DragSource = new DragSource();
            source.addData(dragInitiator,"cart");
            var proxy:Image = new Image();
            proxy.source = event.target;
            proxy.width = 120;
            proxy.height = 150;
            proxy.x = (mouseX - (proxy.width * 3.25));
            proxy.y = (mouseY - (proxy.height * 3.25));
            DragManager.doDrag(dragInitiator, source, event, proxy);
        }
        private function dragEnterHandler(event:DragEvent):void {
            if (event.dragSource.hasFormat("cart")){
                DragManager.acceptDragDrop(event.currentTarget as Image);
            }
        }
        private function dragDropHandler(event:DragEvent):void{

            Alert.show("Gift added to your favorites");
        }
    ]]>
</fx:Script>

<mx:ViewStack id="myStack" width="100%" height="241"  change="doFilter();" creationComplete="doFilter()">

        <s:NavigatorContent label="Shooter"   >

            <!-- hier zet je een tussenruimte van 5-->
            <s:List left="10" top="7" width="100%" height="237" borderColor="#CC0000"
                    borderVisible="false" contentBackgroundAlpha="0.0"
                    dataProvider="{GamesLijst}" itemRenderer="itemrenderers.GameRenderer"
                    rollOverColor="#0492B1" dragMoveEnabled="true" dropEnabled="true" mouseDown="initiateDrag(event)">
                <s:layout >
                    <s:TileLayout horizontalGap="10" verticalGap="10" horizontalAlign="left" verticalAlign="top"/>
                </s:layout>
            </s:List>
        </s:NavigatorContent>
        <s:NavigatorContent label="Sport">
            <!-- hier zet je een tussenruimte van 5-->
            <s:List left="10" top="7" width="100%" height="231" borderColor="#CC0000"
                    borderVisible="false" contentBackgroundAlpha="0.0"
                    dataProvider="{GamesLijst}" itemRenderer="itemrenderers.GameRenderer"
                    rollOverColor="#0492B1"  dragMoveEnabled="true" dropEnabled="true" mouseDown="initiateDrag(event)">
                <s:layout >
                    <s:TileLayout horizontalGap="10" verticalGap="10" horizontalAlign="left" verticalAlign="top"/>
                </s:layout>
            </s:List>
        </s:NavigatorContent>

I want to drag the images out of the viewstack to an image, this is the code:

<s:HGroup includeIn="Home" x="225" width="310" height="90" gap="30" textAlign="left" verticalAlign="middle"> <s:Image width="100" height="100" source="menu/home.png" click.Home="home_clickHandler(event)"/> <s:Image width="100" height="100" source="menu/fav.png" click.Home="favorites_clickHandler(event)" dragEnter="dragEnterHandler(event)" dragDrop="dragDropHandler(event)"/> <s:Image width="100" height="100" source="menu/cart.png" click.Home="cart_clickHandler(event)"/> </s:HGroup>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Marnix Verhulst
  • 161
  • 1
  • 2
  • 9
  • 1
    Why are the two s:list items marked as 'dropEnabled=true'? What is the target for the items to be dragged to? I guess Im not clear on what you're trying to achieve. – ethrbunny Nov 28 '12 at 01:54
  • It have a viewstack with 6 navigatorcontents and I put a list in all 6 navigatorcontents... so I think I have to put a dragEnable="true" all the time? Otherwise I can't drag it. Or do you mean that dragMoveEnabled="true" is the same as dropEnabled="true". I have put the code for the Image I want to drag it to in the code – Marnix Verhulst Nov 28 '12 at 10:05
  • Get rid of the 'dropEnabled' entries in the s:list items. That only needs to be in the place you want the drag to end. – ethrbunny Nov 28 '12 at 13:14
  • Do you want to paste the itemrenderer? – 1321941 Dec 02 '12 at 10:24

0 Answers0