5 Replies Latest reply on Dec 15, 2010 7:07 AM by cosmacol

    Platform specific dragging problem

    pyskoluk Level 1

      Hi,

      recently I noticed one quiete huge difference between AIR application running on MAC OS X or on Windows. When you drag Image component (placed e.g. in Canvas) which is bigger then some particular value (I don't remember exact number but something like higher then 200 points) in Windows then dragged Image is drawn in gradient color in such way that you can't see image borders (so you can't see exact place where the Image is going to be placed) whereas in MAC OS X you would see whole Image also with its borders.

       

      It has the same behaviour with Flex Builder or with Flash Builder but the problem occures only for AIR not Flex.

      Is there any way how to avoid it in Windows?

       

      ThanX,

      //pyso

        • 1. Re: Platform specific dragging problem
          Flex harUI Adobe Employee

          Can you make a small test case and post it?

          • 2. Re: Platform specific dragging problem
            pyskoluk Level 1

            Hi,

            of course. Here you are. Notice that green rectangle is visible during dragging in contrast to red one. The difference is that red one is bigger by one point. Be aware that this behaviour is only on Windows. On MAC OS X it  would work correctly.

             

            Thanks,

            //pyso

             

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:WindowedApplication
                xmlns:mx="http://www.adobe.com/2006/mxml"
                layout="absolute" width="800" height="800"
                creationComplete="init()">
               
                <mx:Script>
                    <![CDATA[
                    import mx.containers.Canvas;
                        import mx.core.Application;
                        import mx.core.DragSource;
                        import mx.managers.DragManager;
                        import mx.events.DragEvent;
                        import mx.collections.ArrayCollection;
                        import mx.controls.Image;
                        import com.adobe.viewsource.ViewSource;
                   
                    private function init():void
                    {
                        red.width = 201;
                        red.height = 201;
                        red.setStyle("backgroundColor", 0xFF0000);
                        red.setStyle("backgroundAlpha", 1);
                       
                        green.width = 200;
                        green.height = 200;
                        green.setStyle("backgroundColor", 0x00FF00);
                        green.setStyle("backgroundAlpha", 1);
                    }
                       
                    private function doDrag(event:MouseEvent):void
                    {
                        var img:Canvas = event.currentTarget as Canvas;
                        var dragImg:Canvas = new Canvas();
                        dragImg = img;
                       
                        var dsource:DragSource = new DragSource();
                        dsource.addData(img, 'img');
                       
                        DragManager.doDrag(img, dsource , event, dragImg);
                    }
                   
                    private function dragAccept(event:DragEvent):void
                    {
                        var dropTarget:Canvas = event.currentTarget as Canvas;
                        DragManager.acceptDragDrop(dropTarget);
                    }
                   
                    private function dragDrop(event:DragEvent):void
                    {
                        var img:Canvas = event.dragSource.dataForFormat('img') as Canvas;
                       
                        var dragInitiatorPoint:Point = new Point(event.dragInitiator.x + event.dragInitiator.mouseX, event.dragInitiator.y  + event.dragInitiator.mouseY);
                       
                        img.x = event.localX + img.x - dragInitiatorPoint.x;
                        img.y = event.localY + img.y - dragInitiatorPoint.y;
                    }
                   
                    ]]>
                </mx:Script>
               
                <mx:Canvas x="0" y="0" width="780" height="780"
                    borderStyle="solid" backgroundColor="#12976A"
                    dragEnter="dragAccept(event)"
                    dragDrop="dragDrop(event)">
                    <mx:Canvas id="red" x="20" y="20" mouseDown="doDrag(event)"  width="200" height="200"/>
                    <mx:Canvas id="green" x="300" y="20" mouseDown="doDrag(event)"  height="250" width="250"/>
                </mx:Canvas>
            </mx:WindowedApplication>

            • 3. Re: Platform specific dragging problem
              Depthblue Level 1

              Hi all,

               

              I have same problem

               

              Can somebody help us with this unpleasant trouble?

               

              //Depthblue

              • 4. Re: Platform specific dragging problem
                pyskoluk Level 1

                Hi again,

                seems that anybody else faced this problem :-(

                 

                //pyso

                • 5. Re: Platform specific dragging problem
                  cosmacol Level 1

                  Just created an issue in the public Adobe bug tracker for this behavior: https://bugs.adobe.com/jira/browse/FP-5952 (watch/vote if you are interested in the resolution).

                   

                  I can confirm that the size thresold is 200x200... the interesting thing is that the effect is probably applied by the Windows API: just try to select a single file in explorer and drag it, then try to select and drag a lot of files: you will notice that, only in the second case, Windows will fade the drag image in the same way to prevent it from becoming too big (tried in Windows XP, Windows 7 has a different management of multiple drag elements).