5 Replies Latest reply: Mar 26, 2013 6:22 AM by DeanLoganBH RSS

    Native Drag And Drop

    Vishal Kumar86

      Hi All,

       

      I have an air project in which I am loading swf based html file using HTML inside Flex Spark Window class which get open after clicking a button.

      Is there any means by which I can add native drag and drop support to that SWF based HTML file.

      Any help will be appreciated.

      Thanks In advance.

        • 1. Re: Native Drag And Drop
          DeanLoganBH Community Member

          Can you be a little more detailed?

           

          Are you trying to drag the HTML document into something else or are you trying to drag items into the HTML document?

          • 2. Re: Native Drag And Drop
            Vishal Kumar86

            Hi Dean,

             

            Thanks for the reply.

            Basically, on clicking button, I am trying to open a remote url(abc.html containg flex application) inside HTML which is a child of Window class .Now, my requirement is to support native drag and drop to that html file.

            Following is the sample code:

            <s:Window creationComplete="window1_creationCompleteHandler(event)">

            <fx:Script>

                    <![CDATA[

            private var url_1: String;

            //Window creation complete handler

                        protected function window1_creationCompleteHandler(event:FlexEvent):void

                        {

                            // TODO Auto-generated method stub

                            htmlloader.htmlLoader.load(new URLRequest(url_1));

                        }

             

            //Open the system notification window

                        public function openWindow(url:String) :void

                        {

                            url_1= url;

                            open();

                            // center the window on the screen

                            var screenBounds:Rectangle = Screen.mainScreen.bounds;

                            nativeWindow.x = (screenBounds.width - nativeWindow.width) / 2;

                            nativeWindow.y = (screenBounds.height - nativeWindow.height) / 2;

                        }


            ]]>

            </fx:Script>

            <mx:HTML id="htmlloader" width="100%" height="100%" verticalScrollPolicy="off"

                             horizontalScrollPolicy="off" top="0" bottom="0" left="0" right="0"/>

            </s:Window>

             

            On click of button, I call  openWindow method of this window.

            • 3. Re: Native Drag And Drop
              DeanLoganBH Community Member

              What is an example of the thing you want to drag into the HTML file?

              • 4. Re: Native Drag And Drop
                Vishal Kumar86

                Hi,

                I want to drag files from Operating system to that html window.

                • 5. Re: Native Drag And Drop
                  DeanLoganBH Community Member

                  You can't drag files from a desktop onto a browser application.

                  You can only drag and drop from the desktop to AIR applications, here is the documentation for doing it in AIR.

                   

                  It maybe possible to upload the file and then drag that file into the HTML.  However, it wouldn't be a simple drag and drop of the information, you would have to insert whatever text is required for the HTML to point to the location of the uploaded file.